-
Sound on 60 seconds and color (Dead) Tags
Ok so I want to add a sound to the game when the room has 60 seconds left when the server displays "60 Seconds Remaining".
The 60 Secs remaining part is in the MMatchRule.cpp . How do I get it working when I define the sound to the ZSoundEngine.h? Or do I need to do something else.
---
Second, I'm busy with the dead tags. I'd like the (Dead) tag to be red.
This is how it was:
Code:
(Dead)Administrator: Hello
(Dead)Developer: Hello
This is how I keep ending up:
Code:
(Dead)Administrator: Hello
(Dead)Developer: Hello
or
(Dead)Administrator: Hello
(Dead)Developer: Hello
This is how I want it:
Code:
(Dead)Administrator: Hello
(Dead)Developer: Hello
---
Can someone help me with these 2 things?
Thanks.
~Patrick
-
Re: Sound on 60 seconds and color (Dead) Tags
-
Re: Sound on 60 seconds and color (Dead) Tags
ZGetGameInterface()->PlayVoiceSound( VOICE_SIXTY_SECOND, 1600);
declare VOICE_SIXTY_SECOND in ZSoundEngine.h
-
Re: Sound on 60 seconds and color (Dead) Tags
Quote:
Originally Posted by
Ronny786
ZGetGameInterface()->PlayVoiceSound( VOICE_SIXTY_SECOND, 1600);
declare VOICE_SIXTY_SECOND in ZSoundEngine.h
Yeah I tried that... This is what I get:
Code:
\CSCommon\Source\MMatchRule.cpp(142): error C2065: 'VOICE_SIXTY_SECOND' : undeclared identifier
\CSCommon\Source\MMatchRule.cpp(142): error C2227: left of '->PlayVoiceSound' must point to class/struct/union
\CSCommon\Source\MMatchRule.cpp(142): error C3861: 'ZGetGameInterface': identifier not found, even with argument-dependent lookup
I declared this in ZSoundEngine.h:
Code:
#define VOICE_SIXTYSEC_REMAIN "nar/NAR37"
This is the code in MMatchRule.cpp:
Code:
else if ((GetLastTimeLimitAnnounce() > 60) && (nTimeRemain < 60*1000)) {
MCommand* pCmd = MMatchServer::GetInstance()->CreateCommand(MC_MATCH_ANNOUNCE, MUID(0,0));
pCmd->AddParameter(new MCmdParamUInt(0));
sprintf(szMsg, "%s%d", MTOK_ANNOUNCE_PARAMSTR, MERR_TIME_60REMAINING);
pCmd->AddParameter(new MCmdParamStr( szMsg));
ZGetGameInterface()->PlayVoiceSound( VOICE_SIXTYSEC_REMAIN, 1600);
MMatchServer::GetInstance()->RouteToStage(GetStage()->GetUID(), pCmd);
SetLastTimeLimitAnnounce(60);
return false;
And another question, where does the 1600 stand for? I see that after every sound, is it volume or something?
-
Re: Sound on 60 seconds and color (Dead) Tags
Quote:
Originally Posted by
Patrick2607
Yeah I tried that... This is what I get:
Code:
\CSCommon\Source\MMatchRule.cpp(142): error C2065: 'VOICE_SIXTY_SECOND' : undeclared identifier
\CSCommon\Source\MMatchRule.cpp(142): error C2227: left of '->PlayVoiceSound' must point to class/struct/union
\CSCommon\Source\MMatchRule.cpp(142): error C3861: 'ZGetGameInterface': identifier not found, even with argument-dependent lookup
I declared this in ZSoundEngine.h:
Code:
#define VOICE_SIXTYSEC_REMAIN "nar/NAR37"
Did you add the header file?
-
Sound on 60 seconds and color (Dead) Tags
Code:
#include ZSoundEngine.h
sadly does not work :(
-
Re: Sound on 60 seconds and color (Dead) Tags
Quote:
Originally Posted by
Patrick2607
Code:
#include ZSoundEngine.h
sadly does not work :(
#include "ZSoundEngine.h"
As for multiple colours, simply look at what MAIET did with their ^ tags.
-
Re: Sound on 60 seconds and color (Dead) Tags
Quote:
Originally Posted by
Wizkidje
#include "ZSoundEngine.h"
As for multiple colours, simply look at what MAIET did with their ^ tags.
Yeah sorry, was on mobile, that's what I have in MMatchRule.
I added this so far:
MMatchRule.cpp:
#include "ZSoundEngine.h"
And this (red) line:
Code:
else if ((GetLastTimeLimitAnnounce() > 60) && (nTimeRemain < 60*1000)) {
MCommand* pCmd = MMatchServer::GetInstance()->CreateCommand(MC_MATCH_ANNOUNCE, MUID(0,0));
pCmd->AddParameter(new MCmdParamUInt(0));
sprintf(szMsg, "%s%d", MTOK_ANNOUNCE_PARAMSTR, MERR_TIME_60REMAINING);
pCmd->AddParameter(new MCmdParamStr( szMsg));
ZGetGameInterface()->PlayVoiceSound( VOICE_60SEC, 1500);
MMatchServer::GetInstance()->RouteToStage(GetStage()->GetUID(), pCmd);
SetLastTimeLimitAnnounce(60);
return false;
ZSoundEngine.h:
#define VOICE_60SEC "nar/NAR80"
Error:
\CSCommon\Source\MMatchRule.cpp(10): fatal error C1083: Cannot open include file: 'ZSoundEngine.h': No such file or directory
-
Re: Sound on 60 seconds and color (Dead) Tags
Do not add that to CSCommon (Common code of GunZ). Instead,
./Gunz/ZGameClient.cpp - ZGameClient::OnAnnounce()...
Code:
void ZGameClient::OnAnnounce(unsigned int nType, char* szMsg)
{
ZIDLResource* pResource = ZApplication::GetGameInterface()->GetIDLResource();
if (strncmp(szMsg, MTOK_ANNOUNCE_PARAMSTR, strlen(MTOK_ANNOUNCE_PARAMSTR)) == 0)
{
const char* szId = szMsg + strlen(MTOK_ANNOUNCE_PARAMSTR);
int idErrMsg = 0;
if (1 == sscanf(szId, "%d", &idErrMsg)) {
char szTranslated[256];
const char* szErrStr = ZErrStr(idErrMsg);
const char* szArg = "";
// タホタレ ニトスフ : ア゙ヌマエマ タマエワ タホタレ 0ーウ カヌエツ 1 ーウサモタフカ・ー。チ、ヌマー・アクヌ・
const char* pSeperator = strchr(szMsg, '\a');
if (pSeperator) {
szArg = pSeperator + 1;
}
sprintf(szTranslated, szErrStr, szArg);
ZChatOutput(szTranslated, ZChat::CMT_SYSTEM);
if(idErrMsg == MERR_TIME_60REMAINING)
{
ZGetGameInterface()->PlayVoiceSound(VOICE_60SEC, 1500);
}
return;
}
}
ZChatOutput(szMsg, ZChat::CMT_SYSTEM);
}
-
Re: Sound on 60 seconds and color (Dead) Tags
Dude get on Skype, ill help u there.
-
Sound on 60 seconds and color (Dead) Tags
-
Re: Sound on 60 seconds and color (Dead) Tags
-
Re: Sound on 60 seconds and color (Dead) Tags
Quote:
Originally Posted by
Ronny786
disgusting !
May i ask why you needed to write this and also what you wrote it about?
-
Re: Sound on 60 seconds and color (Dead) Tags
Quote:
Originally Posted by
aV3PQmCJjM9L
Do not add that to CSCommon (Common code of GunZ). Instead,
./Gunz/ZGameClient.cpp - ZGameClient::OnAnnounce()...
Code:
void ZGameClient::OnAnnounce(unsigned int nType, char* szMsg)
{
ZIDLResource* pResource = ZApplication::GetGameInterface()->GetIDLResource();
if (strncmp(szMsg, MTOK_ANNOUNCE_PARAMSTR, strlen(MTOK_ANNOUNCE_PARAMSTR)) == 0)
{
const char* szId = szMsg + strlen(MTOK_ANNOUNCE_PARAMSTR);
int idErrMsg = 0;
if (1 == sscanf(szId, "%d", &idErrMsg)) {
char szTranslated[256];
const char* szErrStr = ZErrStr(idErrMsg);
const char* szArg = "";
// タホタレ ニトスフ : ア゙ヌマエマ タマエワ タホタレ 0ーウ カヌエツ 1 ーウサモタフカ・ー。チ、ヌマー・アクヌ・
const char* pSeperator = strchr(szMsg, '\a');
if (pSeperator) {
szArg = pSeperator + 1;
}
sprintf(szTranslated, szErrStr, szArg);
ZChatOutput(szTranslated, ZChat::CMT_SYSTEM);
if(idErrMsg == MERR_TIME_60REMAINING)
{
ZGetGameInterface()->PlayVoiceSound(VOICE_60SEC, 1500);
}
return;
}
}
ZChatOutput(szMsg, ZChat::CMT_SYSTEM);
}
Thank you sir, that works :) Any idea where the 1500 number stands for?
Edit: I think the number means the amount of miliseconds the next sound can be played.
Example: VOICE_HEADSHOT,1500
Lets say you got a headshot and fantastic icon above your head. First you'll hear the "Headshot" sound. The headshot sound will take up to 1500 miliseconds before the "Fantastic" sound is played.
But, that's just a guess...
-
Re: Sound on 60 seconds and color (Dead) Tags
Quote:
Originally Posted by
Patrick2607
Thank you sir, that works :) Any idea where the 1500 number stands for?
Edit: I think the number means the amount of miliseconds the next sound can be played.
Example: VOICE_HEADSHOT,1500
Lets say you got a headshot and fantastic icon above your head. First you'll hear the "Headshot" sound. The headshot sound will take up to 1500 miliseconds before the "Fantastic" sound is played.
But, that's just a guess...
It seems.
-
Re: Sound on 60 seconds and color (Dead) Tags
Quote:
Originally Posted by
Sensor
May i ask why you needed to write this and also what you wrote it about?
why do you care lol. :mindownbusiness:
OT: Dont even try to do something like this if you cannot even use pointers
-
Re: Sound on 60 seconds and color (Dead) Tags
Quote:
Originally Posted by
Ronny786
why do you care lol. :mindownbusiness:
OT: Dont even try to do something like this if you cannot even use pointers
So is there any problems with my coding style?
-
Re: Sound on 60 seconds and color (Dead) Tags
Quote:
Originally Posted by
aV3PQmCJjM9L
So is there any problems with my coding style?
i didnt see. its just disgusting because adding a sound effect became a spam thread. its like OMFG
-
Sound on 60 seconds and color (Dead) Tags
Quote:
Originally Posted by
Ronny786
why do you care lol. :mindownbusiness:
OT: Dont even try to do something like this if you cannot even use pointers
I am trying to learn by understanding the code, but yeah, I need the code. I am trying to understand how things work. If that is a problem to you well sorry. A month ago I knew nothing about C++, did not even know how to compile, now I know a little bit more. Every day I work on this I'm learning new things. If you learned C++ in 1 month, congrats. I don't, so don't hate.
-
Re: Sound on 60 seconds and color (Dead) Tags
Quote:
Originally Posted by
Ronny786
i didnt see. its just disgusting because adding a sound effect became a spam thread. its like OMFG
It will not be big problem. Rather I love multi-threading applications. It makes good efficiency.
-
Re: Sound on 60 seconds and color (Dead) Tags
Quote:
Originally Posted by
Ronny786
why do you care lol. :mindownbusiness:
OT: Dont even try to do something like this if you cannot even use pointers
Please do give me proper usage of a pointer.
-
Re: Sound on 60 seconds and color (Dead) Tags
-
Re: Sound on 60 seconds and color (Dead) Tags
Quote:
Originally Posted by
Ronny786
I asked you to give me a proper usage, not to google "pointers" and link me to some MSDN article.
So, again, can you please give me proper usage of a pointer.
-
Re: Sound on 60 seconds and color (Dead) Tags
Quote:
Originally Posted by
Wizkidje
I asked you to give me a proper usage, not to google "pointers" and link me to some MSDN article.
So, again, can you please give me proper usage of a pointer.
ahh, its like adressing one variable to other.. if I'm not wrong.
Like Testme is value of Dont.
Dont * Testme
where variable (testme) is pointed to (dont) .
Now stop !
-
Re: Sound on 60 seconds and color (Dead) Tags
Quote:
Originally Posted by
Ronny786
ahh, its like adressing one variable to other.. if I'm not wrong.
Like Testme is value of Dont.
Dont * Testme
where variable (testme) is pointed to (dont) .
Now stop !
Nope, the (Dont) class's (also struct or typedef) pointer variable (Testme) is pointed to invalid location.
-
Re: Sound on 60 seconds and color (Dead) Tags
Quote:
Originally Posted by
aV3PQmCJjM9L
Nope, the (Dont) class's (also struct or typedef) pointer variable (Testme) is pointed to invalid location.
I'm just explaining a basic concept & declaration
-
Re: Sound on 60 seconds and color (Dead) Tags
Quote:
Originally Posted by
Ronny786
I'm just explaining a basic concept & declaration
However your "basic concept & declaration" was quite inaccurate.
-
Re: Sound on 60 seconds and color (Dead) Tags
Quote:
Originally Posted by
Ronny786
ahh, its like adressing one variable to other.. if I'm not wrong.
Like Testme is value of Dont.
Dont * Testme
where variable (testme) is pointed to (dont) .
Now stop !
Nope, not even close. Proper usage would be something like
PHP Code:
class Test {
public:
char m_szTest[512];
};
void doSomething(Test *pTest) {
strcpy(pTest->m_szTest, "Pointer");
}
void main() {
Test *pTest = new Test();
doSomething(pTest);
printf("%s\n", pTest->m_szTest);
delete pTest;
}
-
Re: Sound on 60 seconds and color (Dead) Tags
Quote:
Originally Posted by
Ronny786
You just find people to underetimate.
No. You're the one trying to point out he's better than Sensor (here).
Quote:
Originally Posted by
Ronny786
m not kind of guy like george to get furious by such chats.
And you're doing it once more. Funny thing to blame me for trying to bash people while you're the one actually bashing.
Quote:
Originally Posted by
Ronny786
+ i never googled what i wrote by myself.
Yeah, hence it being incorrect.
Quote:
Originally Posted by
Ronny786
+ it is correct enough
Not really, no. Doing "Dont * Testme" in C++ (assuming both are variables), your compiler will multiply "Dont" with "Testme". You know, as in 1 * 1 = 1.
-
Re: Sound on 60 seconds and color (Dead) Tags
Peter dude.. I was just trying to explain in short.
Only i wanted to say '*' this matters. i provided good def though.
Chuck topic!
-
Re: Sound on 60 seconds and color (Dead) Tags
Quote:
Originally Posted by
Ronny786
Peter dude.. I was just trying to explain in short.
Only i wanted to say '*' this matters. i provided good def though.
Chuck topic!
I have some my own code work that I want to release here.
However, because of people like you, I pending post.
If I posted releases, people like you would say unnecessary things always. For example,
"Your code XXXXX is absolutely wrong!"
"Your code is messed up!"
"My code XXXXX is better than your YYYYY code!"
"Learn how to code first!"
I don't need answers like this. I need advices or ideas, not complaint or knowledge fight.
I'm very afraid.
So again, in short, don't ruin this section.
-
Re: Sound on 60 seconds and color (Dead) Tags
Ok, so I decided to work on the dead tags. Spent 2 hours (as a C++ newb) but I can't get it fixed on 1 line. However, I can get it on 2 lines. This is the code I have now:
Code:
char szTemp[sizeof(szMsg)+64];
char szDead[64];
MCOLOR DeadColor = MCOLOR(0xFFFF0000);
if(bSpUser && !ZGetGame()->m_pMyCharacter->IsDie()) {
sprintf(szTemp, "%s : %s", pChar->GetProperty()->GetName(),szMsg);
ZChatOutput(UserNameColor, szTemp);
} else if(bSpUser && ZGetGame()->m_pMyCharacter->IsDie()) {
sprintf(szDead, "(Dead)"), sprintf(szTemp, "%s : %s", pChar->GetProperty()->GetName(),szMsg);
ZChatOutput(DeadColor, szDead),ZChatOutput(UserNameColor, szTemp);
} else if(!bSpUser && !ZGetGame()->m_pMyCharacter->IsDie()) {
sprintf(szTemp, "%s : %s", pChar->GetProperty()->GetName(),szMsg);
ZChatOutput(ChatColor, szTemp);
} else if(!bSpUser && ZGetGame()->m_pMyCharacter->IsDie()) {
sprintf(szDead, "(Dead)"), sprintf(szTemp, "%s : %s", pChar->GetProperty()->GetName(),szMsg);
ZChatOutput(DeadColor, szDead),ZChatOutput(ChatColor, szTemp);
}
Output:
Any ideas?
-
Re: Sound on 60 seconds and color (Dead) Tags
Here's my way :
Code:
// 1024 : too much?
char szOutput[1024] = "";
MCOLOR chatcolor = MCOLOR(0xFFD0D0D0);
if(bSpUser) chatcolor = UserNameColor;
if(ZGetGame()->m_pMyCharacter->IsDie())
{
strcat(szOutput, "(Dead) ");
chatcolor = MCOLOR(0xFFFF0000);
}
char szBody[256];
sprintf(szBody, "%s : %s", pChar->GetProperty()->GetName(), szMsg);
strcat(szOutput, szBody);
ZChatOutput(chatcolor, szOutput);
-
Re: Sound on 60 seconds and color (Dead) Tags
Quote:
Originally Posted by
aV3PQmCJjM9L
Here's my way :
Code:
// 1024 : too much?
char szOutput[1024] = "";
MCOLOR chatcolor = MCOLOR(0xFFD0D0D0);
if(bSpUser) chatcolor = UserNameColor;
if(ZGetGame()->m_pMyCharacter->IsDie())
{
strcat(szOutput, "(Dead) ");
chatcolor = MCOLOR(0xFFFF0000);
}
char szBody[256];
sprintf(szBody, "%s : %s", pChar->GetProperty()->GetName(), szMsg);
strcat(szOutput, szBody);
ZChatOutput(chatcolor, szOutput);
That code makes it:
Code:
(Dead) Developer: Text
-
Re: Sound on 60 seconds and color (Dead) Tags
Quote:
Originally Posted by
Patrick2607
That code makes it:
Code:
(Dead) Developer: Text
I have no idea to do that. A only way is use chat color like ^1example.
If you interested to add new color mark, you can try :
./Mint2/Source/MDrawContext.cpp
Code:
// オムツーチルコホナヘ nIndentationククナュ オ鯀ゥセイア篋ヲ ヌムエル, skiplineククナュ タュカホタサ サゥー・テ箙ツヌムエル.
int MDrawContext::TextMultiLine(MRECT& r, const char* szText,int nLineGap,bool bAutoNextLine,int nIndentation,int nSkipLine, MPOINT* pPositions)
{
bool bColorSupport=true;
MBeginProfile(99,"MDrawContext::TextMultiLine");
MCOLOR first_color = GetColor(); // Undo color.
int nLine = 0;
MFont* pFont = GetFont();
int nLength = strlen(szText);
int y = r.y;
const char* szCurrent=szText;
MPOINT* pCurrentPos = pPositions;
do {
int nX = nLine==0 ? 0 : nIndentation;
int nOriginalCharCount = MMGetNextLinePos(pFont,szCurrent,r.w-nX,bAutoNextLine,true);
if(nSkipLine<=nLine)
{
int nCharCount = min(nOriginalCharCount,MAX_CHAR_A_LINE);
char buffer[256];
if(bColorSupport) {
// Textー。 アラキチチツ ニヌ チ、コククヲ テ、ソ・ウヨエツエル.
#define FLUSHPOS(_Pos) if(pCurrentPos!=NULL){ \
for(int i=0; buffer[i]!=NULL; i++){ \
pCurrentPos[i+szCurrent-szText].x = _Pos+pFont->GetWidth(buffer, i); \
pCurrentPos[i+szCurrent-szText].y = y; \
} \
}
#define FLUSH if(buffer[0]) { Text(r.x+nLastX, y, buffer); FLUSHPOS(r.x+nLastX); nLastX=nX; buffer[0]=0;pcurbuf=buffer; }
int nLastX=nX;
buffer[0]=0;
char *pcurbuf=buffer;
for(int i=0; i<nCharCount; i++){
unsigned char c = szCurrent[i], cc = szCurrent[i+1];
// Undo color.
if(c=='^')
{
if(('0'<=cc) && (cc<='9'))
{
FLUSH;
// テ、ニテキ・スコニョクオ サ釤・
SetColor(MCOLOR(MMColorSet[cc - '0']));
i++;
continue;
}
else if(cc=='-')
{
FLUSH;
// テ、ニテキ・スコニョクオ サ釤・
SetColor(first_color);
i++;
continue;
}
}
// End of undo color.
int w;
*(pcurbuf++)=c;
if(c>127 && i<nCharCount){
*(pcurbuf++)=cc;
w = pFont->GetWidth(szCurrent+i,2);
i++;
}
else w = pFont->GetWidth(szCurrent+i,1);
*pcurbuf=0;
nX += w;
}
FLUSH;
}else
{
strncpy(buffer,szCurrent,nCharCount);
buffer[nCharCount]=0;
Text(r.x+nX, y,buffer);
FLUSHPOS(r.x+nX);
}
y+=pFont->GetHeight()+nLineGap;
}
szCurrent+=nOriginalCharCount;
nLine++;
if(y>=r.y+r.h) break;
} while(szCurrent<szText+nLength);
MEndProfile(99);
return nLine-nSkipLine;
}
Undo color does revert back to your first color.
For example,
Code:
^1Hello! ^-How are you?
Administrator : Hello! How are you?
So you can :
Code:
char szOutput[1024] = "";
MCOLOR chatcolor = MCOLOR(0xFFD0D0D0);
if(bSpUser) chatcolor = UserNameColor;
if(ZGetGame()->m_pMyCharacter->IsDie())
{
strcat(szOutput, "^1(Dead) ^-");
chatcolor = MCOLOR(0xFFFF0000);
}
char szBody[256];
sprintf(szBody, "%s : %s", pChar->GetProperty()->GetName(), szMsg);
strcat(szOutput, szBody);
ZChatOutput(chatcolor, szOutput);
and, to add color mark like this correctly, it seems need to edit more place. but I couldn't read all of effect, and this seems ok as now, I didn't.
-
Re: Sound on 60 seconds and color (Dead) Tags
Ok I'll try tomorrow when I continue to work on it. I'll let you know. Thanks so far!
-
Re: Sound on 60 seconds and color (Dead) Tags
Quote:
Originally Posted by
aV3PQmCJjM9L
I have no idea to do that. A only way is use chat color like ^1example.
If you interested to add new color mark, you can try :
./Mint2/Source/MDrawContext.cpp
Code:
// オムツーチルコホナヘ nIndentationククナュ オ鯀ゥセイア篋ヲ ヌムエル, skiplineククナュ タュカホタサ サゥー・テ箙ツヌムエル.
int MDrawContext::TextMultiLine(MRECT& r, const char* szText,int nLineGap,bool bAutoNextLine,int nIndentation,int nSkipLine, MPOINT* pPositions)
{
bool bColorSupport=true;
MBeginProfile(99,"MDrawContext::TextMultiLine");
MCOLOR first_color = GetColor(); // Undo color.
int nLine = 0;
MFont* pFont = GetFont();
int nLength = strlen(szText);
int y = r.y;
const char* szCurrent=szText;
MPOINT* pCurrentPos = pPositions;
do {
int nX = nLine==0 ? 0 : nIndentation;
int nOriginalCharCount = MMGetNextLinePos(pFont,szCurrent,r.w-nX,bAutoNextLine,true);
if(nSkipLine<=nLine)
{
int nCharCount = min(nOriginalCharCount,MAX_CHAR_A_LINE);
char buffer[256];
if(bColorSupport) {
// Textー。 アラキチチツ ニヌ チ、コククヲ テ、ソ・ウヨエツエル.
#define FLUSHPOS(_Pos) if(pCurrentPos!=NULL){ \
for(int i=0; buffer[i]!=NULL; i++){ \
pCurrentPos[i+szCurrent-szText].x = _Pos+pFont->GetWidth(buffer, i); \
pCurrentPos[i+szCurrent-szText].y = y; \
} \
}
#define FLUSH if(buffer[0]) { Text(r.x+nLastX, y, buffer); FLUSHPOS(r.x+nLastX); nLastX=nX; buffer[0]=0;pcurbuf=buffer; }
int nLastX=nX;
buffer[0]=0;
char *pcurbuf=buffer;
for(int i=0; i<nCharCount; i++){
unsigned char c = szCurrent[i], cc = szCurrent[i+1];
// Undo color.
if(c=='^')
{
if(('0'<=cc) && (cc<='9'))
{
FLUSH;
// テ、ニテキ・スコニョクオ サ釤・
SetColor(MCOLOR(MMColorSet[cc - '0']));
i++;
continue;
}
else if(cc=='-')
{
FLUSH;
// テ、ニテキ・スコニョクオ サ釤・
SetColor(first_color);
i++;
continue;
}
}
// End of undo color.
int w;
*(pcurbuf++)=c;
if(c>127 && i<nCharCount){
*(pcurbuf++)=cc;
w = pFont->GetWidth(szCurrent+i,2);
i++;
}
else w = pFont->GetWidth(szCurrent+i,1);
*pcurbuf=0;
nX += w;
}
FLUSH;
}else
{
strncpy(buffer,szCurrent,nCharCount);
buffer[nCharCount]=0;
Text(r.x+nX, y,buffer);
FLUSHPOS(r.x+nX);
}
y+=pFont->GetHeight()+nLineGap;
}
szCurrent+=nOriginalCharCount;
nLine++;
if(y>=r.y+r.h) break;
} while(szCurrent<szText+nLength);
MEndProfile(99);
return nLine-nSkipLine;
}
Undo color does revert back to your first color.
For example,
Code:
^1Hello! ^-How are you?
Administrator : Hello! How are you?
So you can :
Code:
char szOutput[1024] = "";
MCOLOR chatcolor = MCOLOR(0xFFD0D0D0);
if(bSpUser) chatcolor = UserNameColor;
if(ZGetGame()->m_pMyCharacter->IsDie())
{
strcat(szOutput, "^1(Dead) ^-");
chatcolor = MCOLOR(0xFFFF0000);
}
char szBody[256];
sprintf(szBody, "%s : %s", pChar->GetProperty()->GetName(), szMsg);
strcat(szOutput, szBody);
ZChatOutput(chatcolor, szOutput);
and, to add color mark like this correctly, it seems need to edit more place. but I couldn't read all of effect, and this seems ok as now, I didn't.
That is a very very good idea.
-
Re: Sound on 60 seconds and color (Dead) Tags
Works like a charm aV3PQmCJjM9L. Thank you once again for helping me out! :)