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