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
34
#include "
effects/pseffectobjtextable.h
"
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
44
struct
BubbleChatType
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
54
class
psChatBubbles
:
public
iNetSubscriber
55
{
56
private
:
57
psEngine
*
psengine
;
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
psChatBubbles::SetBubbleChatTypes
void SetBubbleChatTypes(csArray< BubbleChatType > chatTypes)
Definition:
chatbubbles.h:87
psChatBubbles::GetBubbleMaxLineLen
size_t GetBubbleMaxLineLen()
Definition:
chatbubbles.h:93
BubbleChatType::chatType
int chatType
Definition:
chatbubbles.h:46
psChatBubbles::setEnabled
void setEnabled(bool enable)
Definition:
chatbubbles.h:91
subscriber.h
psChatBubbles
Creates the effect of a chat bubble on top of character heads taking data from text chat...
Definition:
chatbubbles.h:54
MsgEntry
The structure of 1 queue entry (pointer to a message)
Definition:
message.h:143
BubbleChatType
Definition:
chatbubbles.h:44
psengine
psEngine * psengine
pseffectobjtextable.h
iNetSubscriber
This interface must be implemented by objects that want to receive network messages.
Definition:
subscriber.h:37
psChatBubbles::GetBubbleChatTypes
csArray< BubbleChatType > GetBubbleChatTypes()
Definition:
chatbubbles.h:86
psChatBubbles::isMixingActionColours
bool isMixingActionColours()
Definition:
chatbubbles.h:90
BubbleChatType::enabled
bool enabled
Definition:
chatbubbles.h:49
psChatBubbles::GetBubbleLongPhraseLineCount
size_t GetBubbleLongPhraseLineCount()
Definition:
chatbubbles.h:95
Client
This class collects data of a netclient.
Definition:
client.h:95
pslog::Initialize
void void Initialize(iObjectRegistry *object_reg)
psChatBubbles::GetBubbleShortPhraseCharCount
size_t GetBubbleShortPhraseCharCount()
Definition:
chatbubbles.h:94
BubbleChatType::effectPrefix
char effectPrefix[64]
Definition:
chatbubbles.h:48
psChatBubbles::isEnabled
bool isEnabled()
Definition:
chatbubbles.h:89
psEngine
psEngine This is the main class that contains all the object.
Definition:
psengine.h:94
psEffectTextRow
Definition:
pseffectobjtextable.h:36
BubbleChatType::textSettings
psEffectTextRow textSettings
Definition:
chatbubbles.h:47
client
chatbubbles.h
Generated on Sat Jun 19 2021 05:00:22 for Planeshift by
1.8.11