MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / SendWhisper

Function SendWhisper

netcon/mtclient/mtclient.cpp:2488–2570  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2486}
2487
2488const char *SendWhisper(const char *name) {
2489
2490 int exit_menu = 0;
2491 const char *p;
2492 char message[MAX_CHAT_SEND_LEN];
2493 char pilot_name[MAX_CHAT_SEND_LEN];
2494 static char fmt_msg[MAX_CHAT_SEND_LEN * 2];
2495 void *title_text = DLLCreateNewUITextItem(TXT_PXO_PRIVATEMESSAGE, UICOL_WINDOW_TITLE);
2496
2497 void *cancel_on_text = DLLCreateNewUITextItem(TXT_PXO_CANCEL, UICOL_HOTSPOT_HI);
2498 void *cancel_off_text = DLLCreateNewUITextItem(TXT_PXO_CANCEL, UICOL_HOTSPOT_LO);
2499 void *send_on_text = DLLCreateNewUITextItem(TXT_PXO_SEND, UICOL_HOTSPOT_HI);
2500 void *send_off_text = DLLCreateNewUITextItem(TXT_PXO_SEND, UICOL_HOTSPOT_LO);
2501
2502 void *pilot_text = DLLCreateNewUITextItem(TXT_PXO_PILOTNAME, UICOL_TEXT_NORMAL);
2503 void *message_text = DLLCreateNewUITextItem(TXT_PXO_MESSAGE, UICOL_TEXT_NORMAL);
2504
2505 void *main_wnd = DLLNewUIGameWindowCreate(0, 0, 384, 256, UIF_PROCESS_ALL | UIF_CENTER | NUWF_TITLEMED);
2506
2507 void *title = DLLTextCreate(main_wnd, title_text, 0, 7, UIF_CENTER);
2508 void *pilot = DLLTextCreate(main_wnd, pilot_text, 50, 55, 0);
2509 void *message_t = DLLTextCreate(main_wnd, message_text, 50, 110, 0);
2510 void *user_edit = DLLEditCreate(main_wnd, 10, 50, 75, 130, 15, 0);
2511 void *msg_edit = DLLEditCreate(main_wnd, 3, 50, 130, 200, 15, 0);
2512
2513 // HotSpotCreate(int item,int parentitem, int id, int key, int txtitemoff, int txtitemon, int x, int y, int w, int h,
2514 // int flags,int winnum)
2515 void *cancel_hs =
2516 DLLHotSpotCreate(main_wnd, UID_CANCEL, KEY_ESC, cancel_on_text, cancel_off_text, 130, 256 - 80, 60, 20, 0);
2517 void *send_hs = DLLHotSpotCreate(main_wnd, UID_OK, KEY_ENTER, send_on_text, send_off_text, 60, 256 - 80, 60, 20, 0);
2518 DLLNewUIGameWindowOpen(main_wnd);
2519 // DLLNewUIWindowSetFocusOnEditGadget(msg_edit,main_wnd);
2520 DLLEditSetText(user_edit, name);
2521 while (!exit_menu) {
2522 int res;
2523
2524 res = DLLDoUI();
2525
2526 // handle all UI results.
2527
2528 switch (res) {
2529
2530 case 3:
2531 case UID_OK:
2532 DLLEditGetText(user_edit, pilot_name, MAX_CHAT_SEND_LEN);
2533 DLLEditGetText(msg_edit, message, MAX_CHAT_SEND_LEN);
2534 snprintf(fmt_msg, sizeof(fmt_msg), "/msg %s %s", pilot_name, message);
2535 p = SendChatString(fmt_msg);
2536 if (p && pconsole) {
2537 DLLUIConsoleGadgetputs(pconsole, p);
2538 DLLUIConsoleGadgetputs(pconsole, "\x0a\x0d");
2539 }
2540 exit_menu = 1;
2541 break;
2542 case UID_CANCEL:
2543 exit_menu = 1;
2544 break;
2545 }

Callers 1

MainMultiplayerMenuFunction · 0.85

Calls 2

DLLCreateNewUITextItemFunction · 0.85
SendChatStringFunction · 0.85

Tested by

no test coverage detected