Well, thought I'd sum up the info I posted in another thread for everyone who wants to draw strings through MOHAA's string function.
In the early stages of WAMbot development, I stumbled over that function more or less by chance in OllyDBG:
Code:
void (*R_DrawString) ( int *font, const char *text, float x, float y, int length, int unknown );
Offset: 0x004ac7c0
i chose the names appropreately.
font is actually not int* but probably something like font_t* but i didnt find anything useful inside that struct. declaring it as a pointer to any type is satisfactory. i'll explain how to get that pointer.
text, x, y - text to be drawn at x, y coordinates
length if unknown, pass -1, else it will print only as many letters as you want (gives you the ability to limit the length of the drawn string)
unknown pass 0, or try to find out what other values effect
now, to get a font pointer, you can call a nice function i searched for you:
Code:
int *(*R_RegisterFont) ( const char *name );
Offset: 0x004ac2f0
possible arguments are:
"facfont-20" (standard)
"courier-16"
"courier-18"
"courier-20"
"handle-16"
"handle-18"
"handle-22"
"handle-23"
"marlett"
"verdana-12"
"verdana-14"
If you like colors then this is probably what you want:
Code:
void (*R_SetColor) ( vec4_t rgba );
Offset: 0x004b7fe0
Now, how do you use it? Good question!
Hook the function at offset 0x30020624. It's void func(void) call it whatever you like. (search the forums for info on how to hoook functions). It gets called every frame so you can place your draw code inside it.
Inside your hooked function, you can draw strings like that:
Code:
void hooked_func( void ) {
int *font;
vec4_t colorTransBlue = { 0, 0, 1, 0.5 };
font = R_RegisterFont( "verdana-14" );
R_SetColor( colorTransBlue );
R_DrawString( font, "1337 power by the codinGanimal", 320, 280, -1, 0 );
R_SetColor( NULL ); //reset to white
}
that will draw at 320,280. of course this is inefficient because it would be enough to call R_RegisterFont only once!
I hope I won't find the wrong people using or spreading that stuff without the proper credits!
//edit: i am not sure about the last argument so i better call it "unknown" ...
Credz:
codinGanimal