Hello,
Usually I can find solutions to problems that seem to arise when I'm coding for this game, but I'm stumped on why this is happening..
So I found out how to get the text from the last line of the text box on this game, and I want to separate the player name and what they said and store them in different char arrays.
So I made multiple variances of what I think would work, but they all seem to make the same thing happen; they make the last thing that was said disappear! I'm thinking that I'm misunderstanding something so I'm hoping one of you guys could help me out on this.
Here is the source code:
struct PlayerAnswer{
const char* Player;
const char* Answer;
};
int GetLineCount()
{
DWORD* StageTextClassP = (DWORD*)StageTextClass;
int theLineCount = 0;
__asm{
mov ecx, StageTextClassP;
mov eax, 0x004015F0;
call eax;
mov theLineCount, eax;
}
return theLineCount;
}
char* GetLastText()
{
DWORD* StageTextClassP = (DWORD*)StageTextClass;
char* textLineText;
int lineCount = GetLineCount()-2;
textLineText = (char*)malloc(255);
__asm{
mov ecx, StageTextClassP;
mov eax, 0x0056EC10;
push lineCount;
call eax;
mov textLineText, eax;
}
return textLineText;
}
PlayerAnswer GetLastPlayerAnswer()
{
PlayerAnswer pAnswer;
if(string(GetLastText()).find(':') != string::npos)
{
char* plName = strtok(GetLastText(), ":");;
char* plAnswer = strtok(NULL, "\0");
pAnswer.Player=plName;
pAnswer.Answer=plAnswer;
return pAnswer;
}
pAnswer.Answer="a";
pAnswer.Player="a";
return pAnswer;
}
Oh, and here's pictures on before and after what it looks like:
http://i37.tinypic.com/11lr3hw.jpg
http://i38.tinypic.com/rc91qw.jpg
Tags: