Planeshift
chatbubbles.h
Go to the documentation of this file.
1 /*
2  * Author: Andrew Robberts
3  *
4  * Copyright (C) 2003 Atomic Blue (info@planeshift.it, http://www.atomicblue.org)
5  *
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation (version 2 of the License)
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  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17  *
18  */
19 
20 #ifndef CHAT_BUBBLES_HEADER
21 #define CHAT_BUBBLES_HEADER
22 //=============================================================================
23 // Crystal Space Includes
24 //=============================================================================
25 #include <cstypes.h>
26 #include <csutil/ref.h>
27 #include <csutil/array.h>
28 
29 //=============================================================================
30 // Project Includes
31 //=============================================================================
32 #include "net/subscriber.h"
33 
35 
36 //=============================================================================
37 // Local Includes
38 //=============================================================================
39 
40 //these are special cases used to manage /me /my configurations in chat bubbles
41 #define CHATBUBBLE_ME -2
42 #define CHATBUBBLE_MY -3
43 
45 {
46  int chatType; // the chat type this settings will apply to
47  psEffectTextRow textSettings; // the settings
48  char effectPrefix[64]; // the prefix of the effect name to apply, effects of name <prefix>longphrase, <prefix>normal, and <prefix>shortphrase should exist
49  bool enabled;
50 };
51 
55 {
56 private:
58 
59  csArray<BubbleChatType> chatTypes;
60 
61  size_t bubbleMaxLineLen; // maximum number of characters per line
62  size_t bubbleShortPhraseCharCount; // messages with fewer than this many characters get small bubble
63  size_t bubbleLongPhraseLineCount; // messages with more than this many lines get large bubble
64 
65  bool bubblesEnabled; // enable all chat bubbles
66  bool mixActionColours;
67  BubbleChatType* GetTemplate(int iChatType);
68 
69 public:
70  psChatBubbles();
71  virtual ~psChatBubbles();
72 
73  bool Initialize(psEngine * engine);
74 
84  bool Load(const char * filename, bool saveUserData = false);
85 
86  csArray<BubbleChatType> GetBubbleChatTypes() { return chatTypes; }
87  void SetBubbleChatTypes(csArray<BubbleChatType> chatTypes) { this->chatTypes = chatTypes; }
88 
89  bool isEnabled() { return bubblesEnabled; }
90  bool isMixingActionColours() { return mixActionColours; }
91  void setEnabled(bool enable) { bubblesEnabled = enable; }
92 
93  size_t GetBubbleMaxLineLen() { return bubbleMaxLineLen; }
94  size_t GetBubbleShortPhraseCharCount() { return bubbleShortPhraseCharCount; }
95  size_t GetBubbleLongPhraseLineCount() { return bubbleLongPhraseLineCount; }
96 
97  // implemented iNetSubscriber messages
98  virtual bool Verify(MsgEntry * msg, unsigned int flags, Client *& client);
99  virtual void HandleMessage(MsgEntry * msg, Client * client);
100 
101 };
102 
103 #endif // CHAT_BUBBLES_HEADER
void SetBubbleChatTypes(csArray< BubbleChatType > chatTypes)
Definition: chatbubbles.h:87
size_t GetBubbleMaxLineLen()
Definition: chatbubbles.h:93
void setEnabled(bool enable)
Definition: chatbubbles.h:91
Creates the effect of a chat bubble on top of character heads taking data from text chat...
Definition: chatbubbles.h:54
The structure of 1 queue entry (pointer to a message)
Definition: message.h:143
psEngine * psengine
This interface must be implemented by objects that want to receive network messages.
Definition: subscriber.h:37
csArray< BubbleChatType > GetBubbleChatTypes()
Definition: chatbubbles.h:86
bool isMixingActionColours()
Definition: chatbubbles.h:90
size_t GetBubbleLongPhraseLineCount()
Definition: chatbubbles.h:95
This class collects data of a netclient.
Definition: client.h:95
void void Initialize(iObjectRegistry *object_reg)
size_t GetBubbleShortPhraseCharCount()
Definition: chatbubbles.h:94
char effectPrefix[64]
Definition: chatbubbles.h:48
bool isEnabled()
Definition: chatbubbles.h:89
psEngine This is the main class that contains all the object.
Definition: psengine.h:94
psEffectTextRow textSettings
Definition: chatbubbles.h:47