View Full Version: [code] A variation on WSJ's Ingame Messages

wolfers >>Coding Alliance >>[code] A variation on WSJ's Ingame Messages


<< Prev | Next >>

Deathshead- 02-19-2005
[code] A variation on WSJ's Ingame Messages
Playing around with Darkone's NewWolf Classic Source, I found his ingame messages routines. Porting it into original source, it wouldn't work for me. So, I coded WSJ's messages, then put the effects from Darkon'e Messages inside. Here's the result. What this does, is basically, makes the GetMessage routine Msg_Printf and makes the Message have a cool shadow, like on EOD. /* ======================== = = Msg_Printf = = gets ingame messages = ======================== */ char msg_text[40]; void Msg_Printf (char *lastmessage) { messagetime = 150; // time for message to display strcpy(msg_text, lastmessage); } /* ======================== = = DrawMessage = = displays ingame messages = ======================== */ void DrawMessage (void) { messagetime-=tics; fontnumber = 0; // message's shadow SETFONTCOLOR(0x0,0x1); // set the color PrintX=7; PrintY=1; US_Print(msg_text); // the actual message SETFONTCOLOR(0x9,0x9); // set the color PrintX=8; PrintY=2; US_Print(msg_text); DrawAllPlayBorderSides (); } Notice the new variable, 'msg_text<40>'. This has the same effect as 'gamestate.message', but since it is only needed for these two functions, you can put this here, then delete the message variable from the gamestate structure. Now, when you want a message, you write: Msg_Printf ("Message goes here"); There you go -Deathshead

Conner94- 02-19-2005

Cool! I'll try this in my other project (Maybe War Storm Later)

Deathshead- 02-20-2005

I hope so, the messages people use (they just use the base) is quite boring.

Kyo Kusanagi- 02-21-2005

It Works Good I try That on my "Spear of Dreams:Special Edition"

Conner94- 04-05-2005

Ok, tried it, loved it! It looked so good from the other junk! Oh, and with some of my own magic, it looks like this when you pick something up: Hows the little box? I can write a tutorial on it if you guys want, but you can't really center the text. Is there a way to do that? If so I would like it so the longer/shorter pickups look better.

Flamer46- 04-05-2005

Well nice box Conner. Please write a tutorial on that. To center the text you should try to find out what is the width of the screen then set up something like this: printx = (SCREENWIDTH-MESSAGELENGHT)/2 You could find the MESSAGELENGHT by using that for loop in the code where you display map name on the get psiched thing. As for the Screenwidth i don`t know how your going to find that out.

Forumer™ is Voted #1 Free Forum Hosting provider
Build your own community today with the largest message board hosting company.