MSGLIST.H 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. /*
  2. ** Command & Conquer(tm)
  3. ** Copyright 2025 Electronic Arts Inc.
  4. **
  5. ** This program is free software: you can redistribute it and/or modify
  6. ** it under the terms of the GNU General Public License as published by
  7. ** the Free Software Foundation, either version 3 of the License, or
  8. ** (at your option) any later version.
  9. **
  10. ** This program is distributed in the hope that it will be useful,
  11. ** but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. ** GNU General Public License for more details.
  14. **
  15. ** You should have received a copy of the GNU General Public License
  16. ** along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. /***************************************************************************
  19. * *
  20. * Project Name : Command & Conquer *
  21. * *
  22. * File Name : MSGLIST.H *
  23. * *
  24. * Programmer : Bill R. Randolph *
  25. * *
  26. * Start Date : 05/22/95 *
  27. * *
  28. * Last Update : May 22, 1995 [BRR] *
  29. * *
  30. * How the messages work: *
  31. * - MPlayerMessageList is a gadget list of all current messages *
  32. * - MPlayerMessageX & Y are the upper left corner of the 1st message *
  33. * - MPlayerMaxMessages is the max # of messages allowed, including *
  34. * the editable message; 0 = no limit. *
  35. * - EditLabel points to the textmessage gadget for the current editable *
  36. * field. EditBuf points to the char buffer being edited. EditInitPos *
  37. * & EditCurPos define buffer index positions. *
  38. * - EditSendAddress is the IPX Address to send the message to when RETURN *
  39. * is pressed. *
  40. * *
  41. * The UserData field in the TextLabelClass tells what the timeout for *
  42. * each message is (0 = none). *
  43. * When a message's timeout expires, it's deleted. When a new message *
  44. * is added, the top message is deleted if MPlayerMaxMessages is exceeded. *
  45. * *
  46. * The Edit-able message is never deleted until ESC or RETURN is pressed. *
  47. * *
  48. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  49. #ifndef MSGLIST_H
  50. #define MSGLIST_H
  51. /*
  52. ** Class declaration
  53. */
  54. class MessageListClass {
  55. public:
  56. /*
  57. ** Constructor/Destructor
  58. */
  59. MessageListClass (void);
  60. ~MessageListClass ();
  61. /*
  62. ** Initialization
  63. */
  64. void Init (int x, int y, int max_msg, int maxchars, int height);
  65. TextLabelClass * Add_Message (char *txt, int color, TextPrintType style, int timeout,
  66. unsigned short magic_number, unsigned short crc);
  67. /*
  68. ** Message-editing routines
  69. */
  70. TextLabelClass * Add_Edit (int color, TextPrintType style, char *to, int width);
  71. char * Get_Edit_Buf (void);
  72. /*
  73. ** Maintenance routines
  74. */
  75. int Manage (void);
  76. int Input (KeyNumType &input);
  77. void Draw(void);
  78. int Num_Messages(void);
  79. void Set_Width(int width);
  80. private:
  81. TextLabelClass * MessageList; // list of messages
  82. int MessageX; // x-coord of upper-left
  83. int MessageY; // y-coord of upper-left
  84. int MaxMessages; // max messages allowed
  85. int MaxChars; // max allowed chars per message
  86. int Height; // height in pixels
  87. TextLabelClass *EditLabel; // ptr to current edit label
  88. char *EditBuf; // ptr to current edit buffer
  89. int EditCurPos; // current edit position
  90. int EditInitPos; // initial edit position
  91. int Width; // Maximum width in pixels of editable string
  92. /*
  93. ** Static buffers provided for messages. They must be long enough for
  94. ** both the message, and for the "To" prefix on edited messages, or
  95. ** the "From:" prefix on received messages.
  96. */
  97. static char MessageBuffers[MAX_NUM_MESSAGES][MAX_MESSAGE_LENGTH + 30];
  98. static char BufferAvail[MAX_NUM_MESSAGES];
  99. };
  100. #endif