mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-01-22 09:01:57 -05:00
Use an enum for notify action types
This commit is contained in:
parent
9053303825
commit
06cab0a5a1
5 changed files with 18 additions and 13 deletions
|
@ -307,7 +307,7 @@ void Camera_CycleActive(void) {
|
|||
if (Camera.Active == &cam_FirstPerson) cycle = 0;
|
||||
else if (Camera.Active == &cam_ThirdPerson) cycle = 1;
|
||||
else if (cam_isForwardThird) cycle = 2;
|
||||
CPE_SendNotifyAction(7, cycle);
|
||||
CPE_SendNotifyAction(NOTIFY_ACTION_THIRD_PERSON_CHANGED, cycle);
|
||||
|
||||
/* reset rotation offset when changing cameras */
|
||||
cam_rotOffset.x = 0.0f; cam_rotOffset.y = 0.0f;
|
||||
|
|
|
@ -46,7 +46,7 @@ void Inventory_SetSelectedBlock(BlockID block) {
|
|||
|
||||
Inventory_Set(Inventory.SelectedIndex, block);
|
||||
Event_RaiseVoid(&UserEvents.HeldBlockChanged);
|
||||
CPE_SendNotifyAction(0, block);
|
||||
CPE_SendNotifyAction(NOTIFY_ACTION_BLOCK_LIST_SELECTED, block);
|
||||
}
|
||||
|
||||
void Inventory_PickBlock(BlockID block) {
|
||||
|
|
14
src/Menus.c
14
src/Menus.c
|
@ -1409,14 +1409,14 @@ static void SaveLevelScreen_Save(void* screen, void* widget) {
|
|||
SaveLevelScreen_RemoveOverwrites(s);
|
||||
if ((res = SaveLevelScreen_SaveMap(&path))) return;
|
||||
Chat_Add1("&eSaved map to: %s", &path);
|
||||
CPE_SendNotifyAction(2, 0);
|
||||
CPE_SendNotifyAction(NOTIFY_ACTION_LEVEL_SAVED, 0);
|
||||
}
|
||||
|
||||
static void SaveLevelScreen_UploadCallback(const cc_string* path) {
|
||||
cc_result res = SaveLevelScreen_SaveMap(path);
|
||||
if (!res) {
|
||||
Chat_Add1("&eSaved map to: %s", path);
|
||||
CPE_SendNotifyAction(2, 0);
|
||||
CPE_SendNotifyAction(NOTIFY_ACTION_LEVEL_SAVED, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1562,7 +1562,7 @@ static void TexturePackScreen_EntryClick(void* screen, void* widget) {
|
|||
TexturePack_Url.length = 0;
|
||||
res = TexturePack_ExtractCurrent(true);
|
||||
|
||||
CPE_SendNotifyAction(5, 0);
|
||||
CPE_SendNotifyAction(NOTIFY_ACTION_TEXTURE_PACK_CHANGED, 0);
|
||||
|
||||
/* FileNotFound error may be because user deleted .zips from disc */
|
||||
if (res != ReturnCode_FileNotFound) return;
|
||||
|
@ -2742,8 +2742,8 @@ static void TexPackOverlay_YesClick(void* screen, void* widget) {
|
|||
if (TexPackOverlay_IsAlways(s, widget)) TextureCache_Accept(&s->url);
|
||||
Gui_Remove((struct Screen*)s);
|
||||
|
||||
if (TexPackOverlay_IsAlways(s, widget)) CPE_SendNotifyAction(6, 3);
|
||||
else CPE_SendNotifyAction(6, 2);
|
||||
if (TexPackOverlay_IsAlways(s, widget)) CPE_SendNotifyAction(NOTIFY_ACTION_TEXTURE_PROMPT_RESPONDED, 3);
|
||||
else CPE_SendNotifyAction(NOTIFY_ACTION_TEXTURE_PROMPT_RESPONDED, 2);
|
||||
}
|
||||
|
||||
static void TexPackOverlay_NoClick(void* screen, void* widget) {
|
||||
|
@ -2758,8 +2758,8 @@ static void TexPackOverlay_ConfirmNoClick(void* screen, void* b) {
|
|||
if (s->alwaysDeny) TextureCache_Deny(&s->url);
|
||||
Gui_Remove((struct Screen*)s);
|
||||
|
||||
if (s->alwaysDeny) CPE_SendNotifyAction(6, 0);
|
||||
else CPE_SendNotifyAction(6, 1);
|
||||
if (s->alwaysDeny) CPE_SendNotifyAction(NOTIFY_ACTION_TEXTURE_PROMPT_RESPONDED, 0);
|
||||
else CPE_SendNotifyAction(NOTIFY_ACTION_TEXTURE_PROMPT_RESPONDED, 1);
|
||||
}
|
||||
|
||||
static void TexPackOverlay_GoBackClick(void* screen, void* b) {
|
||||
|
|
|
@ -50,6 +50,11 @@ enum PROTOCOL_VERSION_ {
|
|||
PROTOCOL_0020 = 6, PROTOCOL_0030 = 7,
|
||||
};
|
||||
|
||||
enum NOTIFY_ACTION_TYPE {
|
||||
NOTIFY_ACTION_BLOCK_LIST_SELECTED = 0, NOTIFY_ACTION_BLOCK_LIST_TOGGLED = 1, NOTIFY_ACTION_LEVEL_SAVED = 2,
|
||||
NOTIFY_ACTION_RESPAWNED = 3, NOTIFY_ACTION_SPAWN_UPDATED = 4, NOTIFY_ACTION_TEXTURE_PACK_CHANGED = 5,
|
||||
NOTIFY_ACTION_TEXTURE_PROMPT_RESPONDED = 6, NOTIFY_ACTION_THIRD_PERSON_CHANGED = 7
|
||||
};
|
||||
|
||||
typedef void (*Net_Handler)(cc_uint8* data);
|
||||
#define Net_Set(opcode, handler, size) Protocol.Handlers[opcode] = handler; Protocol.Sizes[opcode] = size;
|
||||
|
|
|
@ -1732,11 +1732,11 @@ static int InventoryScreen_KeyDown(void* screen, int key, struct InputDevice* de
|
|||
/* Accuracy: Original classic doesn't close inventory menu when B is pressed */
|
||||
if (InputBind_Claims(BIND_INVENTORY, key, device) && s->releasedInv && !Game_ClassicMode) {
|
||||
Gui_Remove((struct Screen*)s);
|
||||
CPE_SendNotifyAction(1, 0);
|
||||
CPE_SendNotifyAction(NOTIFY_ACTION_BLOCK_LIST_TOGGLED, 0);
|
||||
} else if (InputDevice_IsEnter(key, device) && table->selectedIndex != -1) {
|
||||
Inventory_SetSelectedBlock(table->blocks[table->selectedIndex]);
|
||||
Gui_Remove((struct Screen*)s);
|
||||
CPE_SendNotifyAction(1, 0);
|
||||
CPE_SendNotifyAction(NOTIFY_ACTION_BLOCK_LIST_TOGGLED, 0);
|
||||
} else if (Elem_HandlesKeyDown(table, key, device)) {
|
||||
} else {
|
||||
return Elem_HandlesKeyDown(&HUDScreen_Instance.hotbar, key, device);
|
||||
|
@ -1768,7 +1768,7 @@ static int InventoryScreen_PointerDown(void* screen, int id, int x, int y) {
|
|||
hotbar = Input_IsCtrlPressed() || Input_IsShiftPressed();
|
||||
if (!hotbar) {
|
||||
Gui_Remove((struct Screen*)s);
|
||||
CPE_SendNotifyAction(1, 0);
|
||||
CPE_SendNotifyAction(NOTIFY_ACTION_BLOCK_LIST_TOGGLED, 0);
|
||||
}
|
||||
}
|
||||
return TOUCH_TYPE_GUI;
|
||||
|
@ -1813,7 +1813,7 @@ void InventoryScreen_Show(void) {
|
|||
|
||||
s->VTABLE = &InventoryScreen_VTABLE;
|
||||
Gui_Add((struct Screen*)s, GUI_PRIORITY_INVENTORY);
|
||||
CPE_SendNotifyAction(1, 1);
|
||||
CPE_SendNotifyAction(NOTIFY_ACTION_BLOCK_LIST_TOGGLED, 1);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue