(Old code tutorial) A variation on WSJ's Ingame Messages from Wolf Planet forum

View previous topic View next topic Go down

(Old code tutorial) A variation on WSJ's Ingame Messages from Wolf Planet forum

Post by Officer-M. John (Admin) on Thu Dec 01, 2016 12:25 pm

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.

Code:

/*
========================
=
= 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

Writte by Deathshead on Sat Feb 19, 2005 9:41 am
avatar
Officer-M. John (Admin)
Admin

Posts : 323
Join date : 2015-10-02
Age : 19

View user profile http://wolf3dfanboys.usersboard.com

Back to top Go down

View previous topic View next topic Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum