For mobile, clicking last slot in inventory hotbar instead opens the inventory. Also replace 'inventory' with 'screenshot' in more menu.

This commit is contained in:
UnknownShadow200 2020-09-19 13:42:48 +10:00
parent 31ea08eead
commit fa355250c1
4 changed files with 17 additions and 9 deletions

View File

@ -13,6 +13,7 @@ extern struct IGameComponent Inventory_Component;
#define INVENTORY_BLOCKS_PER_HOTBAR 9
/* Number of hotbars that can be selected between */
#define INVENTORY_HOTBARS 9
#define HOTBAR_MAX_INDEX (INVENTORY_BLOCKS_PER_HOTBAR - 1)
CC_VAR extern struct _InventoryData {
/* Stores the currently bound blocks for all hotbars. */

View File

@ -47,8 +47,7 @@ struct LWebTask {
cc_result res; /* Error returned (e.g. for DNS failure) */
int status; /* HTTP return code for the request */
int reqID; /* Unique identifier for this web task. */
String url; /* URL this task is downloading from/uploading to. */
int reqID; /* Unique request identifier for this web task. */
/* Called when task successfully downloaded/uploaded data. */
void (*Handle)(cc_uint8* data, cc_uint32 len);
};
@ -65,7 +64,7 @@ void GetTokenTask_Run(void);
extern struct SignInTaskData {
struct LWebTask Base;
String username; /* Username to sign in as. Changed to case correct username. */
const char* error; /* If sign in fails, the reason as to why. */
const char* error; /* If sign in fails, the reason why. */
cc_bool needMFA; /* need login code for multifactor authentication */
} SignInTask;
void SignInTask_Run(const String* user, const String* pass, const String* mfaCode);

View File

@ -3568,9 +3568,9 @@ static void TouchMore_Chat(void* s, void* w) {
Gui_Remove((struct Screen*)&TouchMoreScreen);
ChatScreen_OpenInput(&String_Empty);
}
static void TouchMore_Inv(void* s, void* w) {
static void TouchMore_Take(void* s, void* w) {
Gui_Remove((struct Screen*)&TouchMoreScreen);
InventoryScreen_Show();
Game_ScreenshotRequested = true;
}
static void TouchMore_Menu(void* s, void* w) {
Gui_Remove((struct Screen*)&TouchMoreScreen);
@ -3587,7 +3587,7 @@ static const struct SimpleButtonDesc touchMore_btns[8] = {
{ -160, 0, "Speed", TouchMore_Speed },
{ -160, 50, "Fly", TouchMore_Fly },
{ -160, 100, "Menu", TouchMore_Menu },
{ 160, -50, "Inventory", TouchMore_Inv },
{ 160, -50, "Screenshot", TouchMore_Take },
{ 160, 0, "Fullscreen", TouchMore_Screen },
{ 160, 50, "Noclip", TouchMore_Noclip },
{ 160, 100, "Fog", TouchMore_Fog }

View File

@ -416,6 +416,10 @@ static void HotbarWidget_RenderHotbarBlocks(struct HotbarWidget* w) {
for (i = 0; i < INVENTORY_BLOCKS_PER_HOTBAR; i++) {
x = (int)(w->x + w->slotXOffset + width * i);
y = w->y + (w->height / 2);
#ifdef CC_BUILD_TOUCH
if (i == HOTBAR_MAX_INDEX && Input_TouchMode) continue;
#endif
IsometricDrawer_DrawBatch(Inventory_Get(i), scale, x, y);
}
IsometricDrawer_EndBatch();
@ -510,12 +514,16 @@ static int HotbarWidget_PointerDown(void* widget, int id, int x, int y) {
for (i = 0; i < INVENTORY_BLOCKS_PER_HOTBAR; i++) {
cellX = (int)(w->x + width * i);
cellY = w->y;
if (!Gui_Contains(cellX, cellY, width, height, x, y)) continue;
if (Gui_Contains(cellX, cellY, width, height, x, y)) {
#ifdef CC_BUILD_TOUCH
if (i == HOTBAR_MAX_INDEX && Input_TouchMode) {
InventoryScreen_Show(); return true;
}
#endif
Inventory_SetSelectedIndex(i);
return true;
}
}
return false;
}