Browse Source

Home & End support in item & magic selection.

louyihua 8 years ago
parent
commit
25f11cd80a
5 changed files with 32 additions and 19 deletions
  1. 8 0
      input.c
  2. 2 0
      input.h
  3. 10 9
      itemmenu.c
  4. 10 9
      magicmenu.c
  5. 2 1
      makemessage.py

+ 8 - 0
input.c

@@ -193,6 +193,14 @@ PAL_KeyboardEventFilter(
          g_InputState.dwKeyPress |= kKeyPgDn;
          break;
 
+      case SDLK_HOME:
+         g_InputState.dwKeyPress |= kKeyHome;
+         break;
+
+      case SDLK_END:
+         g_InputState.dwKeyPress |= kKeyEnd;
+         break;
+
       case SDLK_7: //7 for mobile device
       case SDLK_r:
          g_InputState.dwKeyPress |= kKeyRepeat;

+ 2 - 0
input.h

@@ -56,6 +56,8 @@ enum PALKEY
    kKeyFlee        = (1 << 13),
    kKeyStatus      = (1 << 14),
    kKeyForce       = (1 << 15),
+   kKeyHome        = (1 << 16),
+   kKeyEnd         = (1 << 17),
 };
 
 VOID

+ 10 - 9
itemmenu.c

@@ -86,6 +86,14 @@ PAL_ItemSelectMenuUpdate(
    {
       item_delta = iItemsPerLine * iLinesPerPage;
    }
+   else if (g_InputState.dwKeyPress & kKeyHome)
+   {
+      item_delta = -gpGlobals->iCurInvMenuItem;
+   }
+   else if (g_InputState.dwKeyPress & kKeyEnd)
+   {
+      item_delta = g_iNumInventory - gpGlobals->iCurInvMenuItem - 1;
+   }
    else if (g_InputState.dwKeyPress & kKeyMenu)
    {
       return 0;
@@ -98,15 +106,8 @@ PAL_ItemSelectMenuUpdate(
    //
    // Make sure the current menu item index is in bound
    //
-   //if (gpGlobals->iCurInvMenuItem < 0)
-   //{
-   //   gpGlobals->iCurInvMenuItem = 0;
-   //}
-   //else if (gpGlobals->iCurInvMenuItem >= g_iNumInventory)
-   //{
-   //   gpGlobals->iCurInvMenuItem = g_iNumInventory - 1;
-   //}
-   if (gpGlobals->iCurInvMenuItem + item_delta >= 0 && gpGlobals->iCurInvMenuItem + item_delta < g_iNumInventory)
+   if (gpGlobals->iCurInvMenuItem + item_delta >= 0 &&
+       gpGlobals->iCurInvMenuItem + item_delta < g_iNumInventory)
       gpGlobals->iCurInvMenuItem += item_delta;
 
    //

+ 10 - 9
magicmenu.c

@@ -90,6 +90,14 @@ PAL_MagicSelectionMenuUpdate(
    {
       item_delta = iItemsPerLine * iLinesPerPage;
    }
+   else if (g_InputState.dwKeyPress & kKeyHome)
+   {
+      item_delta = -g_iCurrentItem;
+   }
+   else if (g_InputState.dwKeyPress & kKeyEnd)
+   {
+      item_delta = g_iNumMagic - g_iCurrentItem - 1;
+   }
    else if (g_InputState.dwKeyPress & kKeyMenu)
    {
       return 0;
@@ -102,15 +110,8 @@ PAL_MagicSelectionMenuUpdate(
    //
    // Make sure the current menu item index is in bound
    //
-   //if (g_iCurrentItem < 0)
-   //{
-   //   g_iCurrentItem = 0;
-   //}
-   //else if (g_iCurrentItem >= g_iNumMagic)
-   //{
-   //   g_iCurrentItem = g_iNumMagic - 1;
-   //}
-   if (g_iCurrentItem + item_delta >= 0 && g_iCurrentItem + item_delta < g_iNumMagic)
+   if (g_iCurrentItem + item_delta >= 0 &&
+       g_iCurrentItem + item_delta < g_iNumMagic)
       g_iCurrentItem += item_delta;
 
    //

+ 2 - 1
makemessage.py

@@ -90,8 +90,9 @@ def main():
     output += "# Each line is a pattern of 'key=value', where key is an integer and value is a string.\n"
     for i in range(0, len(data_bytes) / options.wordwidth):
         temp = data_bytes[i * options.wordwidth: (i + 1) * options.wordwidth].rstrip('\x20\x00').decode(options.encoding).encode('utf-8')
-        if options.comment: output += "# Original word: %s\n" % temp
+        if options.comment: output += "# Original word: %d=%s\n" % (i, temp)
         output += "%d=%s\n" % (i, temp)
+    output += "# This is the only addtional word for ATB in SDLPAL. It is not used in classical mode.\n"
     output += "65530=Battle Speed"
     output += "[END WORDS]\n\n"