message.cz} message.c%yTEXTCWIEz} a#include #include #include #include "message.h" #include "font.h" typedef struct messnode { char* mess; u_char holding; // Is the message locking the row long x,y; struct messnode *next; } message; static message *messages = NULL; static u_char rows[16]; static u_char startup = 1; void StartUp(void); void Messages(GsOT *OT) { message *messptr = messages; message *lastptr = NULL; short endx; if (startup) StartUp(); while (messptr!=NULL) { endx = PrintMess(OT, 1, messptr->mess, messptr->x, messptr->y); messptr->x-=2; if (endx<256 && messptr->holding) { rows[messptr->y/16] = 0; messptr->holding = 0; } if (endx<0) { // Delete message free(messptr->mess); if (lastptr==NULL) { messages = messptr->next; free(messptr); messptr = messages; } else { lastptr->next = messptr->next; free(messptr); messptr = lastptr->next; } } else { lastptr = messptr; messptr = messptr->next; } } } void NewMessage(char* str) { int i; message *newmess; char *string,*string2; if (startup) StartUp(); i = 15; while (rows[i]==1 && i>0) i--; if (rows[i]==0) { rows[i]=1; newmess = (message*)(malloc(sizeof(message))); newmess->x = 320; newmess->y = i*16; newmess->holding = 1; // Make copy of string string = str; i = 1; while (*(string)!=0) { string++; i++; } string = (char*)malloc(i); string2 = string; while (*(str)!=0) { *(string)=*(str); str++; string++; } *(string) = 0; newmess->mess = string2; newmess->next = messages; messages = newmess; } } void StartUp(void) { int i; startup = 0; for (i=0;i<16;i++) rows[i] = 0; }ZZR $(! $ message.cerere.pdfs DatantallerTEXTCWIEz}*H '