diff --git a/datadir/CONFIG.DAT b/datadir/CONFIG.DAT index 6fa6b57..28f4a2c 100644 Binary files a/datadir/CONFIG.DAT and b/datadir/CONFIG.DAT differ diff --git a/datadir/DEFINE.TXT b/datadir/DEFINE.TXT index 09a9b91..5843e00 100644 --- a/datadir/DEFINE.TXT +++ b/datadir/DEFINE.TXT @@ -470,6 +470,7 @@ #define SYS_SAVE 227 #define SYS_LOAD 228 #define SYS_SCREENPARAMS 229 +#define SYS_INPUTREFRESH 230 #define SYS_MODELCHECKHACK 255 diff --git a/datadir/WCLOSER.SRC b/datadir/WCLOSER.SRC index 54184f5..7f5359d 100644 --- a/datadir/WCLOSER.SRC +++ b/datadir/WCLOSER.SRC @@ -1,3 +1,4 @@ +#define button_refresh self.stat02h #define button_one self.stat02l //----------------------------------------------------------------------- @@ -5,34 +6,46 @@ Spawn() int self self = FindSelf() button_one = 0 + button_refresh = 0 //----------------------------------------------------------------------- Refresh() int self - float screenx + float screenx, screeny, xadd, xpos screenx = SystemGet(SYS_SCREENPARAMS, 0, 2) + xadd = screenx / 2 + xpos = xadd / 2 // Allow us to save data in the window's properties... self = FindSelf() - // Button actions + if(button_refresh == 250) + ButtonSound() + SystemSet(SYS_INPUTREFRESH, 0, 0, 0) + GoPoof(POOF_ALL_OTHER_WINDOWS) + Spawn(WINDOW, xpos, 80.0, 0.0, "FILE:WCONTROL.RUN") + Spawn(WINDOW, xpos + xadd, 80.0, 1.0, "FILE:WCONTROL.RUN") + Spawn(WINDOW, xpos, 210.0, 2.0, "FILE:WCONTROL.RUN") + Spawn(WINDOW, xpos + xadd, 210.0, 3.0, "FILE:WCONTROL.RUN") + Spawn(WINDOW, xadd, 280.0, 1.0, "FILE:WCLOSER.RUN") + GoPoof(POOF_SELF) + if(button_one == 250) ButtonSound() GoPoof(POOF_ALL_OTHER_WINDOWS) - Spawn(WINDOW, screenx / 2, 150.0, 1.0, "FILE:WMAIN.RUN") + Spawn(WINDOW, xadd, 150.0, 1.0, "FILE:WMAIN.RUN") GoPoof(POOF_SELF) - - // Main window - WindowBorder(FALSE, -9.0, -1.0, 18, 2, BORDER_FULL) + WindowBorder(FALSE, -9.0, -2.5, 18, 4, BORDER_FULL) // Button images - button_one = ButtonImage(button_one, 0.0, 0.0, 18.0, 2.0, StringLanguage(20)) + button_refresh = ButtonImage(button_refresh, 0.0, 0.0, 18.0, 2.0, StringLanguage(330)) + button_one = ButtonImage(button_one, 0.0, 2.0, 18.0, 2.0, StringLanguage(20)) //----------------------------------------------------------------------- diff --git a/datadir/WCONTROL.SRC b/datadir/WCONTROL.SRC index 1bab2fd..ce764e9 100644 --- a/datadir/WCONTROL.SRC +++ b/datadir/WCONTROL.SRC @@ -1,13 +1,4 @@ #define device self.stat01w -#define binding0 self.stat02w -#define binding1 self.stat03w -#define binding2 self.stat04w -#define binding3 self.stat05w -#define binding4 self.stat06w -#define binding5 self.stat07w -#define binding6 self.stat08w -#define binding7 self.stat09w -#define binding8 self.stat10w #define player self.stat11l #define mouse_shop self.stat11h @@ -31,48 +22,14 @@ LoadBindings() // Load joystick buttons... if((device>>8) > 1) - binding0 = FileReadByte(file, 18+offset)<<8 - binding1 = FileReadByte(file, 19+offset)<<8 - binding2 = FileReadByte(file, 20+offset)<<8 - binding3 = FileReadByte(file, 21+offset)<<8 - binding4 = FileReadByte(file, 22+offset)<<8 - - // Camera controls a little later... - binding5 = FileReadByte(file, 24+offset)<<8 - binding6 = FileReadByte(file, 25+offset)<<8 - binding7 = FileReadByte(file, 26+offset)<<8 - binding8 = FileReadByte(file, 27+offset)<<8 - - // Make sure they're within limits... - if(binding0 > 4096) - binding0 = 4096 - if(binding1 > 4096) - binding1 = 4096 - if(binding2 > 4096) - binding2 = 4096 - if(binding3 > 4096) - binding3 = 4096 - if(binding4 > 4096) - binding4 = 4096 - if(binding5 > 4096) - binding5 = 4096 - if(binding6 > 4096) - binding6 = 4096 - if(binding7 > 4096) - binding7 = 4096 - if(binding8 > 4096) - binding8 = 4096 - - SystemSet(SYS_PLAYERDEVICE, player, 0, (binding0>>8)) - SystemSet(SYS_PLAYERDEVICE, player, 1, (binding1>>8)) - SystemSet(SYS_PLAYERDEVICE, player, 2, (binding2>>8)) - SystemSet(SYS_PLAYERDEVICE, player, 3, (binding3>>8)) - SystemSet(SYS_PLAYERDEVICE, player, 4, (binding4>>8)) - SystemSet(SYS_PLAYERDEVICE, player, 5, (binding5>>8)) - SystemSet(SYS_PLAYERDEVICE, player, 6, (binding6>>8)) - SystemSet(SYS_PLAYERDEVICE, player, 7, (binding7>>8)) - SystemSet(SYS_PLAYERDEVICE, player, 8, (binding8>>8)) - + i = 0 + while(i < 9) + if(i < 5) + key = FileReadByte(file, offset + i + 18) + if(i > 4) + key = FileReadByte(file, offset + i + 19) + SystemSet(SYS_PLAYERDEVICE, player, i, key) + i++ // Load mouse shop stuff... mouse_shop = FileReadByte(file, offset+28) @@ -102,17 +59,14 @@ SaveBindings() // Save joystick buttons... if((device>>8) > 1) - FileWriteByte(file, offset+18, binding0>>8) - FileWriteByte(file, offset+19, binding1>>8) - FileWriteByte(file, offset+20, binding2>>8) - FileWriteByte(file, offset+21, binding3>>8) - FileWriteByte(file, offset+22, binding4>>8) - - // Camera controls a little later... - FileWriteByte(file, offset+24, binding5>>8) - FileWriteByte(file, offset+25, binding6>>8) - FileWriteByte(file, offset+26, binding7>>8) - FileWriteByte(file, offset+27, binding8>>8) + i = 0 + while(i < 9) + key = SystemGet(SYS_PLAYERDEVICE, player, i) + if(i < 5) + FileWriteByte(file, offset + i + 18, key) + if(i > 4) + FileWriteByte(file, offset + i + 19, key) + i++ // Save mouse shop stuff... @@ -131,7 +85,7 @@ Spawn() //----------------------------------------------------------------------- Refresh() - int i, self, option_string, joystick_count, old_device + int i, self, joystick_count, old_device int lastkey, current, mouse_shop @@ -143,14 +97,11 @@ Refresh() StringClear(String(0)) StringAppend(String(0), StringLanguage(3), 256) StringAppendNumber(String(0), player+1, 256) - TitleBar(TRUE, 0.0, -5.5, String(0)) + TitleBar(FALSE, 0.0, -5.5, String(0)) // Main window WindowBorder(FALSE, -9.0, -5.5, 18, 11, BORDER_FULL) - option_string = StringLanguage(42) - - // Pick mode by device number... @@ -165,19 +116,8 @@ Refresh() WindowString(WHITE, 0.0, 3.0, StringLanguage(246)) WindowString(WHITE, 0.0, 2.0, StringLanguage(43)) WindowString(WHITE, 0.0, 1.0, StringLanguage(41)) - if((device>>8)==0 || (device>>8)==1) - // No device or Keyboard... Do hidden minilists to make - // sure items don't get confused... - WindowMiniList(0.0, 0.0, 0, 0, 0, NULL) - WindowMiniList(0.0, 0.0, 0, 0, 0, NULL) - WindowMiniList(0.0, 0.0, 0, 0, 0, NULL) - WindowMiniList(0.0, 0.0, 0, 0, 0, NULL) - WindowMiniList(0.0, 0.0, 0, 0, 0, NULL) - WindowMiniList(0.0, 0.0, 0, 0, 0, NULL) - WindowMiniList(0.0, 0.0, 0, 0, 0, NULL) - WindowMiniList(0.0, 0.0, 0, 0, 0, NULL) - WindowMiniList(0.0, 0.0, 0, 0, 0, NULL) - else + + if((device>>8) > 1) // Joystick device... i = 0 while(i < 4) @@ -190,26 +130,61 @@ Refresh() WindowString(WHITE, 7.0, i+6, ":") i++ - binding8 = WindowMiniList(9.0, 9.0, 9, 17, binding8, option_string) - binding7 = WindowMiniList(9.0, 8.0, 9, 17, binding7, option_string) - binding6 = WindowMiniList(9.0, 7.0, 9, 17, binding6, option_string) - binding5 = WindowMiniList(9.0, 6.0, 9, 17, binding5, option_string) - binding4 = WindowMiniList(9.0, 5.0, 9, 17, binding4, option_string) - binding3 = WindowMiniList(9.0, 4.0, 9, 17, binding3, option_string) - binding2 = WindowMiniList(9.0, 3.0, 9, 17, binding2, option_string) - binding1 = WindowMiniList(9.0, 2.0, 9, 17, binding1, option_string) - binding0 = WindowMiniList(9.0, 1.0, 9, 17, binding0, option_string) - - // Apply the joystick bindings... - SystemSet(SYS_PLAYERDEVICE, player, 0, (binding0>>8)) - SystemSet(SYS_PLAYERDEVICE, player, 1, (binding1>>8)) - SystemSet(SYS_PLAYERDEVICE, player, 2, (binding2>>8)) - SystemSet(SYS_PLAYERDEVICE, player, 3, (binding3>>8)) - SystemSet(SYS_PLAYERDEVICE, player, 4, (binding4>>8)) - SystemSet(SYS_PLAYERDEVICE, player, 5, (binding5>>8)) - SystemSet(SYS_PLAYERDEVICE, player, 6, (binding6>>8)) - SystemSet(SYS_PLAYERDEVICE, player, 7, (binding7>>8)) - SystemSet(SYS_PLAYERDEVICE, player, 8, (binding8>>8)) + + i = 0 + while(i < 9) + if(WindowImage(9.0, i+1, 9.0, 1.0, NULL, NULL, 0) == 255) + SystemGet(SYS_LASTKEYPRESSED, 0, 0) // Clear out lastkey... + SystemSet(SYS_PLAYERDEVICE, player, i, 0) + i++ + // Show current buttons + i = 0 + while(i < 9) + current = SystemGet(SYS_PLAYERDEVICE, player, i) + StringClear(String(0)) + if(current == 0) + lastkey = SystemGet(SYS_LASTKEYPRESSED, (device>>8), 0) + if(lastkey != 0) + current = lastkey + SystemSet(SYS_PLAYERDEVICE, player, i, lastkey) + if(current) + if(current < 20) + StringAppend(String(0), "Btn", 16) + StringAppendNumber(String(0), current, 16) + if(current == 20) + StringAppend(String(0), "DPadU", 16) + if(current == 21) + StringAppend(String(0), "DPadD", 16) + if(current == 22) + StringAppend(String(0), "DPadL", 16) + if(current == 23) + StringAppend(String(0), "DPadR", 16) + if(current == 26) + StringAppend(String(0), "LTrigg", 16) + if(current == 29) + StringAppend(String(0), "RTrigg", 16) + if(current == 24) + StringAppend(String(0), "RJoyL", 16) + if(current == 25) + StringAppend(String(0), "RJoyU", 16) + if(current == 27) + StringAppend(String(0), "RJoyR", 16) + if(current == 28) + StringAppend(String(0), "RJoyD", 16) + if(current < 0 || current > 29) + StringAppend(String(0), "<", 16) + StringAppend(String(0), StringLanguage(331), 16) + StringAppend(String(0), ">", 16) + if(current == 0) + StringAppend(String(0), "???", 16) + WindowString(White, 9.0, i+1, String(0)) + i++ + else + // Make sure we don't screw up the item number... + i = 0 + while(i < 9) + WindowImage(9.0, i+1, 0.0, 0.0, NULL, NULL, 0) + i++ @@ -240,7 +215,7 @@ Refresh() current = SystemGet(SYS_PLAYERDEVICE, player, i) StringClear(String(0)) if(current == 0) - lastkey = SystemGet(SYS_LASTKEYPRESSED, 0, 0) + lastkey = SystemGet(SYS_LASTKEYPRESSED, (device>>8), 0) if(lastkey != 0) current = lastkey SystemSet(SYS_PLAYERDEVICE, player, i, lastkey) @@ -280,12 +255,13 @@ Refresh() i++ - - // Input selection joystick_count = SystemGet(SYS_NUMJOYSTICK, 0, 0) if(joystick_count > 4) joystick_count = 4 + if((device >> 8) > joystick_count + 1) + device = 0 + SystemSet(SYS_PLAYERDEVICE, player, PLAYER_DEVICE_TYPE, 0) WindowString(WHITE, 0.0, 0.0, StringLanguage(39)) old_device = device device = WindowMiniList(9.0, 0.0, 9, joystick_count+2, device, StringLanguage(40)) diff --git a/language/ENGLISH.txt b/language/ENGLISH.txt index 9099fa7..d976a98 100644 --- a/language/ENGLISH.txt +++ b/language/ENGLISH.txt @@ -327,3 +327,5 @@ Dogs are better than cats! Learn to LUCID DREAM! Eat more fruit! Smile more! Smile NOW! +Refresh devices +empty \ No newline at end of file diff --git a/language/FRENCH.txt b/language/FRENCH.txt index 54a7443..edb0915 100644 --- a/language/FRENCH.txt +++ b/language/FRENCH.txt @@ -327,3 +327,5 @@ Les chiens sont meilleurs que les chats ! Apprends à faire des RÊVES LUCIDES ! Mange plus de fruits ! Souris davantage ! Souriez MAINTENANT ! +Actualiser +vide \ No newline at end of file diff --git a/language/GERMAN.txt b/language/GERMAN.txt index 0e42e95..1352a8b 100644 --- a/language/GERMAN.txt +++ b/language/GERMAN.txt @@ -327,3 +327,5 @@ Hunde sind besser als Katzen! Lerne zu LUCID DREAM! Iss mehr Obst! Laechle mehr! Laechle JETZT! +Aktualisieren +leer \ No newline at end of file diff --git a/language/ITALIAN.txt b/language/ITALIAN.txt index 3615169..54cc497 100644 --- a/language/ITALIAN.txt +++ b/language/ITALIAN.txt @@ -327,3 +327,5 @@ I cani sono meglio dei gatti! Imparate a SOGNARE LUCIDO! Mangiate più frutta! Sorridete di più! Sorridete ora! +Aggiorna +vuoto \ No newline at end of file diff --git a/language/POLISH.txt b/language/POLISH.txt index f132a66..d812dbf 100644 --- a/language/POLISH.txt +++ b/language/POLISH.txt @@ -327,3 +327,5 @@ Psy sa lepsze od kotow! Naucz sie SNIC SWIADOMIE! Jedz wiecej owocow! Usmiechaj sie wiecej! Usmiechnij sie TERAZ! +OdÕwie× urzÐdzenia +puste \ No newline at end of file diff --git a/language/SPANISH.txt b/language/SPANISH.txt index 457996f..3eec751 100644 --- a/language/SPANISH.txt +++ b/language/SPANISH.txt @@ -327,3 +327,5 @@ La televisi ¡Aprende a SOÑAR LUCIDO! ¡Come más fruta! ¡Sonríe más! ¡Sonríe AHORA! +Actualizar +vacío \ No newline at end of file diff --git a/source/input.c b/source/input.c index ededdc9..5b8568a 100644 --- a/source/input.c +++ b/source/input.c @@ -38,7 +38,7 @@ unsigned char key_buffer_read; // FIFO read position unsigned char key_buffer_write; // FIFO write position unsigned char key_shift[MAX_ASCII]; // Convert an SDLK_ to ASCII caps unsigned short last_key_pressed = 0; // The sdlk value of the last key pressed... - +unsigned short last_btn_pressed = 0; #define MOUSE_TEXT_TIME 10 // Number of ticks mouse text should show after taking off of character... @@ -73,13 +73,13 @@ unsigned char mouse_camera_active = FALSE; // #define MAX_JOYSTICK 8 -#define MAX_JOYSTICK_BUTTON 16 +#define MAX_JOYSTICK_BUTTON 30 int num_joystick; void* joystick_structure[MAX_JOYSTICK]; // Used for closing the joysticks... unsigned char joystick_button_pressed[MAX_JOYSTICK][MAX_JOYSTICK_BUTTON]; unsigned char joystick_button_unpressed[MAX_JOYSTICK][MAX_JOYSTICK_BUTTON]; unsigned char joystick_button_down[MAX_JOYSTICK][MAX_JOYSTICK_BUTTON]; -float joystick_position_xy[MAX_JOYSTICK][2]; // -1.0 to 1.0... +float joystick_position_xy[MAX_JOYSTICK][5]; // -1.0 to 1.0... //------------------------------------------------------------------------------------------- @@ -370,7 +370,6 @@ void input_setup(void) } } - SDL_JoystickEventState(SDL_ENABLE); num_joystick = SDL_NumJoysticks(); log_message("INFO: Turning on %d joysticks...", num_joystick); @@ -384,7 +383,6 @@ void input_setup(void) } atexit(input_free_joysticks); - // Turn off all of the player devices... repeat(i, MAX_LOCAL_PLAYER) { @@ -459,7 +457,8 @@ void input_read(void) unsigned short i, j, num_keys; SDL_Scancode key; const unsigned char* key_state; - int temp; + int temp, dpad_offset = 20; + int trigger_offset = 24, trigger_threshold = 1600; @@ -575,16 +574,55 @@ void input_read(void) { joystick_position_xy[event.jaxis.which][event.jaxis.axis] = (event.jaxis.value-JOY_TOLERANCE)/(32768.0f-JOY_TOLERANCE); } + } else if (event.jaxis.axis == 2 || event.jaxis.axis == 5) { + // For listen trigger left and trigger right in controller + if(event.jaxis.value > trigger_threshold) { + if(!joystick_button_down[event.jaxis.which][event.jaxis.axis + trigger_offset]) { + joystick_button_pressed[event.jaxis.which][event.jaxis.axis + trigger_offset] = TRUE; + joystick_button_down[event.jaxis.which][event.jaxis.axis + trigger_offset] = TRUE; + last_btn_pressed = event.jaxis.axis + trigger_offset; + } + } else { + if(joystick_button_down[event.jaxis.which][event.jaxis.axis + trigger_offset]) { + joystick_button_unpressed[event.jaxis.which][event.jaxis.axis + trigger_offset] = TRUE; + joystick_button_down[event.jaxis.which][event.jaxis.axis + trigger_offset] = FALSE; + } + } + } else if (event.jaxis.axis == 3 || event.jaxis.axis == 4) { + // For listen right joystick + joystick_position_xy[event.jaxis.which][event.jaxis.axis] = 0.0f; + if(event.jaxis.value < -JOY_TOLERANCE) { + joystick_position_xy[event.jaxis.which][event.jaxis.axis] = 1.0f; + if(joystick_position_xy[event.jaxis.which][event.jaxis.axis]) { + joystick_button_pressed[event.jaxis.which][event.jaxis.axis + trigger_offset - 3] = TRUE; + joystick_button_down[event.jaxis.which][event.jaxis.axis + trigger_offset - 3] = TRUE; + last_btn_pressed = event.jaxis.axis + trigger_offset - 3; + } + } else if(event.jaxis.value > JOY_TOLERANCE) { + joystick_position_xy[event.jaxis.which][event.jaxis.axis] = 1.0f; + if(joystick_position_xy[event.jaxis.which][event.jaxis.axis]) { + joystick_button_pressed[event.jaxis.which][event.jaxis.axis + trigger_offset] = TRUE; + joystick_button_down[event.jaxis.which][event.jaxis.axis + trigger_offset] = TRUE; + last_btn_pressed = event.jaxis.axis + trigger_offset; + } + } + if(joystick_button_down[event.jaxis.which][event.jaxis.axis + trigger_offset - 3] && !joystick_position_xy[event.jaxis.which][event.jaxis.axis]) { + joystick_button_unpressed[event.jaxis.which][event.jaxis.axis + trigger_offset - 3] = TRUE; + joystick_button_down[event.jaxis.which][event.jaxis.axis + trigger_offset - 3] = FALSE; + } else if(joystick_button_down[event.jaxis.which][event.jaxis.axis + trigger_offset] && !joystick_position_xy[event.jaxis.which][event.jaxis.axis]) { + joystick_button_unpressed[event.jaxis.which][event.jaxis.axis + trigger_offset] = TRUE; + joystick_button_down[event.jaxis.which][event.jaxis.axis + trigger_offset] = FALSE; + } } - } + } break; case SDL_JOYBUTTONUP: if(event.jbutton.which < MAX_JOYSTICK) { if(event.jbutton.button < MAX_JOYSTICK_BUTTON) { - joystick_button_unpressed[event.jbutton.which][event.jbutton.button] = TRUE; - joystick_button_down[event.jbutton.which][event.jbutton.button] = FALSE; + joystick_button_unpressed[event.jbutton.which][event.jbutton.button+1] = TRUE; + joystick_button_down[event.jbutton.which][event.jbutton.button+1] = FALSE; } } break; @@ -593,8 +631,64 @@ void input_read(void) { if(event.jbutton.button < MAX_JOYSTICK_BUTTON) { - joystick_button_pressed[event.jbutton.which][event.jbutton.button] = TRUE; - joystick_button_down[event.jbutton.which][event.jbutton.button] = TRUE; + joystick_button_pressed[event.jbutton.which][event.jbutton.button+1] = TRUE; + joystick_button_down[event.jbutton.which][event.jbutton.button+1] = TRUE; + last_btn_pressed = event.jbutton.button + 1; + } + } + break; + case SDL_JOYHATMOTION: + if(event.jhat.which < MAX_JOYSTICK) { + if(event.jhat.value & SDL_HAT_UP) { + if(!joystick_button_down[event.jhat.which][dpad_offset + 0]) { + joystick_button_pressed[event.jhat.which][dpad_offset + 0] = TRUE; + joystick_button_down[event.jhat.which][dpad_offset + 0] = TRUE; + last_btn_pressed = dpad_offset + 0; + } + } else { + if(joystick_button_down[event.jhat.which][dpad_offset + 0]) { + joystick_button_unpressed[event.jhat.which][dpad_offset + 0] = TRUE; + joystick_button_down[event.jhat.which][dpad_offset + 0] = FALSE; + } + } + + if(event.jhat.value & SDL_HAT_DOWN) { + if(!joystick_button_down[event.jhat.which][dpad_offset + 1]) { + joystick_button_pressed[event.jhat.which][dpad_offset + 1] = TRUE; + joystick_button_down[event.jhat.which][dpad_offset + 1] = TRUE; + last_btn_pressed = dpad_offset + 1; + } + } else { + if(joystick_button_down[event.jhat.which][dpad_offset + 1]) { + joystick_button_unpressed[event.jhat.which][dpad_offset + 1] = TRUE; + joystick_button_down[event.jhat.which][dpad_offset + 1] = FALSE; + } + } + + if(event.jhat.value & SDL_HAT_LEFT) { + if(!joystick_button_down[event.jhat.which][dpad_offset + 2]) { + joystick_button_pressed[event.jhat.which][dpad_offset + 2] = TRUE; + joystick_button_down[event.jhat.which][dpad_offset + 2] = TRUE; + last_btn_pressed = dpad_offset + 2; + } + } else { + if(joystick_button_down[event.jhat.which][dpad_offset + 2]) { + joystick_button_unpressed[event.jhat.which][dpad_offset + 2] = TRUE; + joystick_button_down[event.jhat.which][dpad_offset + 2] = FALSE; + } + } + + if(event.jhat.value & SDL_HAT_RIGHT) { + if(!joystick_button_down[event.jhat.which][dpad_offset + 3]) { + joystick_button_pressed[event.jhat.which][dpad_offset + 3] = TRUE; + joystick_button_down[event.jhat.which][dpad_offset + 3] = TRUE; + last_btn_pressed = dpad_offset + 3; + } + } else { + if(joystick_button_down[event.jhat.which][dpad_offset + 3]) { + joystick_button_unpressed[event.jhat.which][dpad_offset + 3] = TRUE; + joystick_button_down[event.jhat.which][dpad_offset + 3] = FALSE; + } } } break; diff --git a/source/runsrc.c b/source/runsrc.c index 693c0c3..e602b27 100644 --- a/source/runsrc.c +++ b/source/runsrc.c @@ -283,6 +283,7 @@ const char ff_map[MAX_FAST_FUNCTION][32] = { #define SYS_SAVE 227 #define SYS_LOAD 228 #define SYS_SCREENPARAMS 229 +#define SYS_INPUTREFRESH 230 #define SYS_MODELCHECKHACK 255 @@ -1536,6 +1537,21 @@ signed char run_script(unsigned char* address, unsigned char* file_start, unsign // Delay window ordering effect until after all windows have been drawn... delay_promote(); break; + case SYS_INPUTREFRESH: + input_setup_key_buffer(); + input_setup_key_shift(); + SDL_JoystickEventState(SDL_ENABLE); + num_joystick = SDL_NumJoysticks(); + repeat(i, num_joystick) + { + if(i < MAX_JOYSTICK) + { + joystick_structure[i] = SDL_JoystickOpen(i); + log_message("INFO: %d... %s", i, SDL_JoystickName(joystick_structure[i])); + } + } + atexit(input_free_joysticks); + break; case SYS_SFXVOLUME: master_sfx_volume = m; break; @@ -3923,7 +3939,12 @@ sprintf(DEBUG_STRING, "Autotrim length == %f", autotrim_length); i = (get_number_of_bones((unsigned char*) j) == get_number_of_bones((unsigned char*) k)); break; case SYS_LASTKEYPRESSED: - i = last_key_pressed; + if(j == 1) { + i = last_key_pressed; + } else if( j > 1) { + i = last_btn_pressed; + } + last_btn_pressed = 0; last_key_pressed = 0; break; case SYS_CURSORLASTPOS: