diff --git a/org.srb2.SRB2Kart-Saturn.metainfo.xml b/org.srb2.SRB2Kart-Saturn.metainfo.xml deleted file mode 100644 index 54c1de8b2..000000000 --- a/org.srb2.SRB2Kart-Saturn.metainfo.xml +++ /dev/null @@ -1,80 +0,0 @@ - - - - org.srb2.SRB2Kart-Saturn - FSFAP - GPL-2.0+ - Sonic Robo Blast 2 Kart Saturn - Modded SRB2Kart adding many custom features - -

- A modded net-compatible version of SRB2Kart v1.6 that offers multiple code optimizations, palette rendering, player sprite rotation, base Kart HUD customization, and many more. -

-
- org.srb2.SRB2Kart-Saturn.desktop - - - https://wiki.srb2.org/w/images/a/ac/Srb2kart_title.png - Title screen - - - https://user-images.githubusercontent.com/15758649/227740700-26e0962b-5572-486c-b633-7d4990d86f89.png - Game modes - - - https://user-images.githubusercontent.com/1964655/82821921-3d180c00-9ea5-11ea-937b-e1f53fe6c686.png - Game play as Sonic - - - https://user-images.githubusercontent.com/1964655/82821933-41442980-9ea5-11ea-9146-38998161edae.png - Game play as Tails - - - https://user-images.githubusercontent.com/1964655/82821966-502adc00-9ea5-11ea-9cbd-274d7adb479e.png - Game play as Eggman - - - https://user-images.githubusercontent.com/1964655/82821980-5620bd00-9ea5-11ea-9eec-2835ebb2a262.png - Game play as Metal Sonic - - - https://github.com/Indev450/SRB2Kart-Saturn - https://github.com/Indev450/SRB2Kart-Saturn/issues - Indev450 - - srb2kart - - - - -

The complete changelog can be found on the build's GitHub repository.

-
- https://github.com/Indev450/SRB2Kart-Saturn/releases/tag/v5.1 -
- - -

The complete changelog can be found on the build's GitHub repository.

-
- https://github.com/Indev450/SRB2Kart-Saturn/releases/tag/v5 -
-
- - Game - SportsGame - - - keyboard - gamepad - - - moderate - mild - intense - mild - - - doom - multiplayer - racing - -
diff --git a/src/console.c b/src/console.c index 02116b009..6b56746a9 100644 --- a/src/console.c +++ b/src/console.c @@ -643,6 +643,30 @@ INT32 CON_ShiftChar(INT32 ch) return ch; } +INT32 CON_ShitAndAltGrChar(INT32 ch) +{ + if ((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z')) + { + if (shiftdown ^ capslock) + ch = shiftxform[ch]; + } + else // if we're holding shift we should still shift non letter symbols + { + if (shiftdown) + ch = shiftxform[ch]; + else if (altdown & 0x2) + { + ch = french_altgrxform[ch]; + } + else + { + ch = HU_FallBackFrSpecialLetter(ch); + } + } + + return ch; +} + // Clear time of console heads up messages // void CON_ClearHUD(void) @@ -941,7 +965,7 @@ boolean CON_Responder(event_t *ev) return true; // ctrl modifier -- changes behavior, adds shortcuts - if (ctrldown) + if ((cv_keyboardlayout.value != 3 && ctrldown) || (cv_keyboardlayout.value == 3 && ctrldown && !altdown)) { // show all cvars/commands that match what we have inputted if (key == KEY_TAB) @@ -1211,13 +1235,37 @@ boolean CON_Responder(event_t *ev) // same capslock code as hu_stuff.c's HU_responder. Check there for details. if ((key >= 'a' && key <= 'z') || (key >= 'A' && key <= 'Z')) { - if (shiftdown ^ capslock) - key = shiftxform[key]; + if (cv_keyboardlayout.value == 3) + { + if (shiftdown ^ capslock) + key = shiftxform[key]; + else if (altdown & 0x2) + key = french_altgrxform[key]; + else + key = HU_FallBackFrSpecialLetter(key); + } + else + { + if (shiftdown ^ capslock) + key = shiftxform[key]; + } } else { - if (shiftdown) - key = shiftxform[key]; + if (cv_keyboardlayout.value == 3) + { + if (shiftdown) + key = shiftxform[key]; + else if (altdown & 0x2) + key = french_altgrxform[key]; + else + key = HU_FallBackFrSpecialLetter(key); + } + else + { + if (shiftdown) + key = shiftxform[key]; + } } // enter a char into the command prompt diff --git a/src/console.h b/src/console.h index 377306b9f..d51ab36b5 100644 --- a/src/console.h +++ b/src/console.h @@ -46,6 +46,7 @@ extern UINT8 *yellowmap, *purplemap, *greenmap, *bluemap, *graymap, *redmap, *or extern UINT8 *consolebgmap; INT32 CON_ShiftChar(INT32 ch); +INT32 CON_ShitAndAltGrChar(INT32 ch); void CON_SetupBackColormap(void); void CON_ClearHUD(void); // clear heads up messages diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 4de32845e..cfb283558 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -821,7 +821,7 @@ void D_RegisterServerCommands(void) CV_RegisterVar(&cv_recordmultiplayerdemos); CV_RegisterVar(&cv_netdemosyncquality); CV_RegisterVar(&cv_maxdemosize); - CV_RegisterVar(&cv_nativekeyboard); + CV_RegisterVar(&cv_keyboardlayout); } // ========================================================================= diff --git a/src/g_game.c b/src/g_game.c index 91bf3c781..d7ac0e8ff 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -8461,7 +8461,7 @@ boolean G_DemoTitleResponder(event_t *ev) if (len < 64) { demo.titlename[len+1] = 0; - demo.titlename[len] = CON_ShiftChar(ch); + demo.titlename[len] = cv_keyboardlayout.value == 3 ? CON_ShitAndAltGrChar(ch) : CON_ShiftChar(ch); } } else if (ch == KEY_BACKSPACE) diff --git a/src/hardware/r_opengl/r_opengl.c b/src/hardware/r_opengl/r_opengl.c index 669375ace..564d94eba 100644 --- a/src/hardware/r_opengl/r_opengl.c +++ b/src/hardware/r_opengl/r_opengl.c @@ -987,6 +987,40 @@ void SetStates(void) pglScalef(1.0f, 1.0f, -1.0f); pglGetFloatv(GL_MODELVIEW_MATRIX, modelMatrix); // added for new coronas' code (without depth buffer) } +// -----------------+ +// DeleteTexture : Deletes a texture from the GPU and frees its data +// -----------------+ +EXPORT void HWRAPI(DeleteTexture) (GLMipmap_t *pTexInfo) +{ + FTextureInfo *head = TexCacheHead; + + if (!pTexInfo) + return; + else if (pTexInfo->downloaded) + pglDeleteTextures(1, (GLuint *)&pTexInfo->downloaded); + + while (head) + { + if (head->downloaded == pTexInfo->downloaded) + { + if (head->next) + head->next->prev = head->prev; + else // no next -> tail is being deleted -> update TexCacheTail + TexCacheTail = head->prev; + if (head->prev) + head->prev->next = head->next; + else // no prev -> head is being deleted -> update TexCacheHead + TexCacheHead = head->next; + free(head); + break; + } + + head = head->next; + } + + pTexInfo->downloaded = 0; +} + void GLFramebuffer_Generate(void) { diff --git a/src/hu_stuff.c b/src/hu_stuff.c index cc3278812..4224b992c 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -174,6 +174,107 @@ char english_shiftxform[] = '{', '|', '}', '~', 127 }; +char french_shiftxform[] = +{ + 0, + 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, + 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, + 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, + 31, + ' ','$', //shift-! + '3', //shift-" + '#', '$', '%', + '1', //shift-& + '4', // shift-' + '5', // shift-( + ')', // shift-) + '*', '+', + '?', // shift-, + '6', // shift-- + '.', '/', + '0', '1', '2', '3', '4', '5', + '6', '7', '8', '9', + '/', // shitf-: + '.', // shift-; + '>', // shift-< + '+', // shift-= + '>', '?', '@', + 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', + 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', + '[', '\\', ']', '^', + '8', //shift-_ + '`', + 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', + 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', + '{', '|', '}', '~', 127, + 128, 129, + '2', + 131, 132, + '0', + 134, + '9', + 136, 137, + '7', + 139, 140, + '%' +}; + +char french_altgrxform[] = +{ + 0, + 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, + 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, + 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, + 31, + ' ', '!', + '#', //altgr-" + '#', '$', '%', '&', + '{', //altgr-' + '[', //altgr-( + ']', //altgr-) + '*', '+', ',', + '|', //altg-- + '.', '/', + '0', '1', '2', '3', '4', '5', + '6', '7', '8', '9', + ':', ';', '<', + '}', //altgr-= + '>', '?', '@', + 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', + 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', + '[', '\\', ']', '^', + '\\', //altgr-backslash + '`', + 'a', 'b', 'c', 'd', 'E', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', + 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', + '{', '|', '}', '~', 127, + 128, 129, + '~', + 131, 132, + '@', + 134, + '^', + 136, 137, + '`', + 139, 140, + KEY_FR_U_GRAVE +}; + +//fallback for special letter non displayable in the game (i.e.: 'é','à',etc.) +INT32 HU_FallBackFrSpecialLetter(INT32 key) +{ + switch(key){ + case KEY_FR_E_AIGUE: return 'e'; + case KEY_FR_E_GRAVE: return 'e'; + case KEY_FR_C_CEDILLE: return 'c'; + case KEY_FR_A_GRAVE: return 'a'; + case KEY_FR_U_GRAVE: return 'u'; + default: return key; + } +} + + + static char cechotext[1024]; static tic_t cechotimer = 0; static tic_t cechoduration = 5*TICRATE; @@ -371,6 +472,11 @@ void HU_Start(void) headsupactive = true; } +void HU_Shiftform(void) +{ + shiftxform = cv_keyboardlayout.value == 3 ? french_shiftxform : english_shiftxform; +} + //====================================================================== // EXECUTION //====================================================================== @@ -1378,7 +1484,7 @@ boolean HU_Responder(event_t *ev) && ev->data1 != gamecontrol[gc_talkkey][1])) return false; - c = CON_ShiftChar(c); + c = cv_keyboardlayout.value == 3 ? CON_ShitAndAltGrChar(c) : CON_ShiftChar(c); // pasting. pasting is cool. chat is a bit limited, though :( if (((c == 'v' || c == 'V') && ctrldown) && !CHAT_MUTE) diff --git a/src/hu_stuff.h b/src/hu_stuff.h index eb2461146..66459c716 100644 --- a/src/hu_stuff.h +++ b/src/hu_stuff.h @@ -47,6 +47,12 @@ extern char *shiftxform; // english translation shift table extern char english_shiftxform[]; +extern char french_shiftxform[]; +extern char french_altgrxform[]; + +//fallback for special letter non displayable in the game (i.e.: 'é','à',etc.) +INT32 HU_FallBackFrSpecialLetter(INT32 key); + //------------------------------------ // sorted player lines //------------------------------------ @@ -109,6 +115,8 @@ void HU_LoadGraphics(void); // reset heads up when consoleplayer respawns. void HU_Start(void); +void HU_Shiftform(void); + boolean HU_Responder(event_t *ev); void HU_Ticker(void); void HU_TickSongCredits(void); diff --git a/src/keys.h b/src/keys.h index d78ff574d..0129e49c1 100644 --- a/src/keys.h +++ b/src/keys.h @@ -15,7 +15,7 @@ #include "console.h" -extern consvar_t cv_nativekeyboard; +extern consvar_t cv_keyboardlayout; // These are the key codes as posted by the keyboard handler, // ascii codes are 0->127, @@ -30,6 +30,14 @@ extern consvar_t cv_nativekeyboard; #define KEY_MINUS 45 #define KEY_EQUALS 61 +//azerty special keys support +//(necessary for being able to print 'regular' chars in azerty) +#define KEY_FR_E_AIGUE (0x80+2) +#define KEY_FR_E_GRAVE (0x80+10) +#define KEY_FR_C_CEDILLE (0x80+7) +#define KEY_FR_A_GRAVE (0x80+5) +#define KEY_FR_U_GRAVE (0x80+13) + #define KEY_NUMLOCK (0x80+69) #define KEY_SCROLLLOCK (0x80+70) diff --git a/src/m_menu.c b/src/m_menu.c index 35580fc2e..0fa213d48 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -2011,7 +2011,7 @@ static menuitem_t OP_SaturnMenu[] = {IT_STRING | IT_CVAR, NULL, "Show Localskin Menus", &cv_showlocalskinmenus, 90}, {IT_STRING | IT_CVAR, NULL, "Uppercase Menu", &cv_menucaps, 95}, - {IT_STRING | IT_CVAR, NULL, "Native Keyboard Layout", &cv_nativekeyboard, 105}, + {IT_STRING | IT_CVAR, NULL, "Keyboard Layout", &cv_keyboardlayout, 105}, {IT_STRING | IT_CVAR, NULL, "Less Midnight Channel Flicker", &cv_lessflicker, 115}, @@ -2043,7 +2043,7 @@ static const char* OP_SaturnTooltips[] = "Show the big Cecho Messages.", "Show Localskin Menus.", "Force menu to only use uppercase.", - "Use your native Keyboard Layout for Text Input\nThis does not affect gameplay!.", + "Use your desired Keyboard Layout for Text Input\nthis is either the Default, Native or Azerty\nNative does not affect Gameplay only Text!", "Disables the flicker effect on Midnight Channel.", "Nametag Options.", "Driftgauge Options.", @@ -3300,8 +3300,23 @@ static boolean M_ChangeStringCvar(INT32 choice) char buf[MAXSTRINGLENGTH]; size_t len; - if (shiftdown && choice >= 32 && choice <= 127) - choice = shiftxform[choice]; + if (cv_keyboardlayout.value == 3) + { + if (choice >= 32 && choice <= 141) + { + if (shiftdown) + choice = shiftxform[choice]; + else if (altdown & 0x2) + choice = french_altgrxform[choice]; + else + choice = HU_FallBackFrSpecialLetter(choice); + } + } + else + { + if (shiftdown && choice >= 32 && choice <= 127) + choice = shiftxform[choice]; + } switch (choice) { @@ -3323,7 +3338,7 @@ static boolean M_ChangeStringCvar(INT32 choice) } return true; default: - if (choice >= 32 && choice <= 127) + if ((cv_keyboardlayout.value != 3 && choice >= 32 && choice <= 127) || (cv_keyboardlayout.value == 3 && choice >= 32 && choice <= 141)) { len = strlen(cv->string); if (len < MAXSTRINGLENGTH - 1) @@ -3648,8 +3663,23 @@ boolean M_Responder(event_t *ev) if (routine && (currentMenu->menuitems[itemOn].status & IT_TYPE) == IT_KEYHANDLER) { menu_text_input = true; - if (shiftdown && ch >= 32 && ch <= 127) - ch = shiftxform[ch]; + if (cv_keyboardlayout.value == 3) + { + if(ch >= 32 && ch <= 141) + { + if (shiftdown) + ch = shiftxform[ch]; + else if (altdown & 0x2) + ch = french_altgrxform[ch]; + else + ch = HU_FallBackFrSpecialLetter(ch); + } + } + else + { + if (shiftdown && ch >= 32 && ch <= 127) + ch = shiftxform[ch]; + } routine(ch); return true; } @@ -3689,8 +3719,23 @@ boolean M_Responder(event_t *ev) if ((currentMenu->menuitems[itemOn].status & IT_CVARTYPE) == IT_CV_STRING) { menu_text_input = true; - if (shiftdown && ch >= 32 && ch <= 127) - ch = shiftxform[ch]; + if (cv_keyboardlayout.value == 3) + { + if(ch >= 32 && ch <= 141) + { + if (shiftdown) + ch = shiftxform[ch]; + else if (altdown & 0x2) + ch = french_altgrxform[ch]; + else + ch = HU_FallBackFrSpecialLetter(ch); + } + } + else + { + if (shiftdown && ch >= 32 && ch <= 127) + ch = shiftxform[ch]; + } if (M_ChangeStringCvar(ch)) return true; else @@ -6389,8 +6434,23 @@ static void M_AddonAutoLoad(INT32 ch) #define len menusearch[0] static boolean M_ChangeStringAddons(INT32 choice) { - if (shiftdown && choice >= 32 && choice <= 127) - choice = shiftxform[choice]; + if (cv_keyboardlayout.value == 3) + { + if(choice >= 32 && choice <= 141) + { + if(shiftdown) + choice = shiftxform[choice]; + else if(altdown & 0x2) + choice = french_altgrxform[choice]; + else + choice = HU_FallBackFrSpecialLetter(choice); + } + } + else + { + if (shiftdown && choice >= 32 && choice <= 127) + choice = shiftxform[choice]; + } switch (choice) { diff --git a/src/sdl/i_video.c b/src/sdl/i_video.c index cbecc1fee..d904ee597 100644 --- a/src/sdl/i_video.c +++ b/src/sdl/i_video.c @@ -111,7 +111,14 @@ boolean a2c = false; #endif boolean highcolor = false; -consvar_t cv_nativekeyboard = {"nativekeyboard", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; + +static void KeyboardLayout_OnChange(void) +{ + HU_Shiftform(); +} + +static CV_PossibleValue_t keyboardlayout_cons_t[] = {{1,"Default US"}, {2, "Native"}, {3, "AZERTY"}, {0, NULL}}; +consvar_t cv_keyboardlayout = {"keyboardlayout", "Default US", CV_SAVE|CV_CALL, keyboardlayout_cons_t, KeyboardLayout_OnChange, 0, NULL, NULL, 0, 0, NULL}; static void Impl_SetVsync(void); @@ -535,6 +542,82 @@ static INT32 GetTypedChar(SDL_Scancode code, SDL_Keysym *sym) return 0; } +static INT32 Impl_SDL_Keysym_To_Keycode_FR(SDL_Keysym keysym) +{ + SDL_Keycode keycode= keysym.sym; + SDL_Scancode scancode= keysym.scancode; + + if (keycode >= SDLK_a && keycode <= SDLK_z){ + // get lowercase ASCII + return keycode; + } + if (keycode >= SDLK_F1 && keycode <= SDLK_F10) + { + return KEY_F1 + (keycode - SDLK_F1); + } + if(scancode == SDL_SCANCODE_APOSTROPHE){ + return KEY_FR_U_GRAVE; + } + switch(scancode){ + case SDL_SCANCODE_APOSTROPHE: return KEY_FR_U_GRAVE; + case SDL_SCANCODE_LEFTBRACKET: return '^'; + default: break; + } + switch (keycode) + { + // F11 and F12 are separated from the rest of the function keys + case SDLK_F11: return KEY_F11; + case SDLK_F12: return KEY_F12; + + case SDLK_RETURN: return KEY_ENTER; + case SDLK_ESCAPE: return KEY_ESCAPE; + case SDLK_BACKSPACE: return KEY_BACKSPACE; + case SDLK_TAB: return KEY_TAB; + case SDLK_SPACE: return KEY_SPACE; + case SDLK_EQUALS: return KEY_EQUALS; + case SDLK_SEMICOLON: return ';'; + case SDLK_COMMA: return ','; + case SDLK_COLON: return ':'; + case SDLK_EXCLAIM: return '!'; + case SDLK_DOLLAR: return '$'; + case SDLK_ASTERISK: return '*'; + case SDLK_PERCENT: return '%'; + case SDLK_0: return KEY_FR_A_GRAVE; + case SDLK_1: + case SDLK_AMPERSAND: return '&'; + case SDLK_2: return KEY_FR_E_AIGUE; + case SDLK_3: + case SDLK_QUOTEDBL: return '"'; + case SDLK_4: return '\''; + case SDLK_5: + case SDLK_LEFTPAREN: return '('; + case SDLK_6: + case SDLK_MINUS: return KEY_MINUS; + case SDLK_7: return KEY_FR_E_GRAVE; + case SDLK_8: + case SDLK_UNDERSCORE: return '_'; + case SDLK_9: return KEY_FR_C_CEDILLE; + case SDLK_RIGHTPAREN: return ')'; + case SDLK_SLASH: return '/'; + case SDLK_LESS: return '<'; + + + case SDLK_KP_0: return KEY_KEYPAD0; + case SDLK_KP_1: return KEY_KEYPAD1; + case SDLK_KP_2: return KEY_KEYPAD2; + case SDLK_KP_3: return KEY_KEYPAD3; + case SDLK_KP_4: return KEY_KEYPAD4; + case SDLK_KP_5: return KEY_KEYPAD5; + case SDLK_KP_6: return KEY_KEYPAD6; + case SDLK_KP_7: return KEY_KEYPAD7; + case SDLK_KP_8: return KEY_KEYPAD8; + case SDLK_KP_9: return KEY_KEYPAD9; + + default: break; + } + return Impl_SDL_Scancode_To_Keycode(scancode); +} + static void SDLdoGrabMouse(void) { SDL_ShowCursor(SDL_DISABLE); @@ -850,8 +933,10 @@ static void Impl_HandleKeyboardEvent(SDL_KeyboardEvent evt, Uint32 type) return; } - if (cv_nativekeyboard.value && (chat_on || CON_Ready() || (menu_text_input && menuactive))) //only use this this if on chat or console or the current menu wants inputs from us (except if its the control setup menu ig) + if (cv_keyboardlayout.value == 2 && (chat_on || CON_Ready() || (menu_text_input && menuactive))) //only use this this if on chat or console or the current menu wants inputs from us (except if its the control setup menu ig) event.data1 = GetTypedChar(evt.keysym.scancode, &evt.keysym); + else if (cv_keyboardlayout.value == 3) + event.data1 = Impl_SDL_Keysym_To_Keycode_FR(evt.keysym); else event.data1 = Impl_SDL_Scancode_To_Keycode(evt.keysym.scancode);