Update of /cvsroot/netrek/client/netrekxp/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14006/src
Added Files:
beeplite.c litebitmaps.h
Log Message:
First attempt at reimport of beeplite into NetrekXP. Unresolved issue: improper text clearing on TTS beeplite messages. Still to add: saving of beeplite settings in save_options.
--- NEW FILE: beeplite.c ---
/* beeplite.c
*
* $Log: beeplite.c,v $
* Revision 1.1 2006/04/18 13:47:24 modemhero
* First attempt at reimport of beeplite into NetrekXP. Unresolved issue: improper text clearing on TTS beeplite messages. Still to add: saving of beeplite settings in save_options.
*
* Revision 1.1.1.1 1998/11/01 17:24:08 siegl
* COW 3.0 initial revision
* Added back to NetrekXP 2006/04/17 balcerski
*
*/
#include "config.h"
#ifdef BEEPLITE
#include "copyright.h"
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
#include <ctype.h>
#ifndef SERVER
#include "Wlib.h"
#endif
#include "defs.h"
#include "struct.h"
#include "data.h"
#include "map.h"
#include "proto.h"
rcdlite(struct distress *dist)
/* the info */
{
char message[100];
int len = 0;
if ((dist == NULL) ||
/* (dist->sender == me->p_no) || */
(distlite[dist->distype] == NULL))
return;
len = makedistress(dist, message, distlite[dist->distype]);
if (len <= 0)
return;
makelite(dist, message);
}
litedefaults(void)
{
if (distlite[take] == NULL)
distlite[take] = "/c/l";
if (distlite[base_ogg] == NULL)
distlite[base_ogg] = "/g/m";
if (distlite[pickup] == NULL)
distlite[pickup] = "/p";
if (distlite[generic] == NULL)
distlite[generic] = "%?%S=SB%{/c%}";
}
liteplanet(struct planet *l)
{
emph_planet_seq_n[l->pl_no] = beep_lite_cycle_time_planet;
l->pl_flags |= PLREDRAW; /* Leave redraw on until * *
* done highlighting */
l->pl_flags |= PLCLEAR; /* Leave redraw on until * *
* done highlighting */
}
liteplayer(struct player *j)
{
if (!j || (j->p_flags & PFCLOAK))
return;
redrawPlayer[j->p_no] = 1;
emph_player_seq_n[j->p_no] = beep_lite_cycle_time_player;
}
/* small permutation on makedistress. Searches for the highliting *
* arguments, ignores everything else. */
makelite(struct distress * dist, char *pm)
/* the info */
/* macro to parse, used for distress and macro */
{
struct player *sender;
struct player *j;
struct planet *l;
char *strcap(char *s);
char c;
sender = &players[dist->sender];
if (!(*pm))
{
return (0);
}
/* first step is to substitute variables */
while (*pm)
{
if (*pm == '/')
{
pm++;
if (!pm)
continue;
switch (c = *(pm++))
{
case 'P': /* push player id into buf */
case 'G': /* push friendly player id *
*
* * into buf */
case 'H': /* push enemy target player
* * * id into buf */
case 'p': /* push player id into buf */
case 'g': /* push friendly player id *
*
* * into buf */
case 'h': /* push enemy target player
* * * id into buf */
switch (c)
{
case 'p':
j = &players[dist->tclose_j];
break;
case 'g':
j = &players[dist->tclose_fr];
break;
case 'h':
j = &players[dist->tclose_en];
break;
case 'P':
j = &players[dist->close_j];
break;
case 'G':
j = &players[dist->close_fr];
break;
default:
j = &players[dist->close_en];
break;
}
liteflag = (F_beeplite_flags & (LITE_PLAYERS_MAP | LITE_PLAYERS_LOCAL));
liteplayer(j);
break;
case 'B': /* highlites planet nearest
* * * sender */
case 'b':
l = &planets[dist->close_pl];
if (F_beeplite_flags & LITE_PLANETS)
liteplanet(l);
break;
case 'L': /* highlites planet nearest
* * * pointer */
case 'l':
l = &planets[dist->tclose_pl];
if (F_beeplite_flags & LITE_PLANETS)
liteplanet(l);
break;
case 'U': /* highlites enemy nearest *
*
* * pointer */
case 'u':
j = &players[dist->tclose_en];
liteflag = (F_beeplite_flags & (LITE_PLAYERS_MAP | LITE_PLAYERS_LOCAL));
liteplayer(j);
break;
case 'c': /* highlites sender */
case 'I':
case 'i':
liteflag = (F_beeplite_flags & (LITE_PLAYERS_MAP | LITE_PLAYERS_LOCAL));
liteplayer(sender);
break;
case 'M': /* highlites me */
case 'm':
if (F_beeplite_flags & LITE_SELF)
{
liteflag = (LITE_PLAYERS_MAP | LITE_PLAYERS_LOCAL);
liteplayer(me);
}
break;
case '0':
if (F_beeplite_flags & LITE_SOUNDS)
{
#ifdef SOUND
if (sound_toggle)
Play_Sound(MESSAGE_SOUND);
else
#endif
W_Beep();
}
break;
#ifdef SOUND
case '1':
if (F_beeplite_flags & LITE_SOUNDS)
Play_Sound(MESSAGE1_SOUND);
break;
case '2':
if (F_beeplite_flags & LITE_SOUNDS)
Play_Sound(MESSAGE2_SOUND);
break;
case '3':
if (F_beeplite_flags & LITE_SOUNDS)
Play_Sound(MESSAGE3_SOUND);
break;
case '4':
if (F_beeplite_flags & LITE_SOUNDS)
Play_Sound(MESSAGE4_SOUND);
break;
case '5':
if (F_beeplite_flags & LITE_SOUNDS)
Play_Sound(MESSAGE5_SOUND);
break;
case '6':
if (F_beeplite_flags & LITE_SOUNDS)
Play_Sound(MESSAGE6_SOUND);
break;
case '7':
if (F_beeplite_flags & LITE_SOUNDS)
Play_Sound(MESSAGE7_SOUND);
break;
case '8':
if (F_beeplite_flags & LITE_SOUNDS)
Play_Sound(MESSAGE8_SOUND);
break;
case '9':
if (F_beeplite_flags & LITE_SOUNDS)
Play_Sound(MESSAGE9_SOUND);
break;
#endif
/* Text between: /| | will be displayed with TTS */
case '|':
if (F_beeplite_flags & LITE_TTS)
{
for (tts_len = 0; (*pm != '|' && tts_len < tts_max_len); tts_len++)
lastIn[tts_len] = *pm++;
lastIn[tts_len] = '\0';
tts_width = W_TTSTextWidth(lastIn, tts_len);
tts_timer = tts_time;
}
break;
default:
/* try to continue * bad macro character is skipped entirely, *
* * * the message will be parsed without whatever argument has
* * * occurred. - jn */
warning("Bad Macro character in distress!");
fprintf(stderr, "Unrecognizable special character in distress pass 1: %c\n", *(pm - 1));
break;
}
}
else
{
pm++;
}
}
return (1);
}
#endif /* BEEPLITE */
--- NEW FILE: litebitmaps.h ---
#define emph_planet_seq_width 24
#define emph_planet_seq_height 24
#define emph_planet_seq_frames 5
static char emph_planet_seq_bits[emph_planet_seq_frames][72] =
{
{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x00,
0x00, 0x83, 0x01, 0xc0, 0x00, 0x06, 0x40, 0x00, 0x04, 0x20, 0x00, 0x08,
0x20, 0x00, 0x08, 0x10, 0x00, 0x10, 0x10, 0x00, 0x10, 0x10, 0x00, 0x10,
0x10, 0x00, 0x10, 0x10, 0x00, 0x10, 0x20, 0x00, 0x08, 0x20, 0x00, 0x08,
0x40, 0x00, 0x04, 0xc0, 0x00, 0x06, 0x00, 0x83, 0x01, 0x00, 0x7c, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x80, 0x01, 0x03,
0x40, 0x00, 0x04, 0x20, 0x00, 0x08, 0x10, 0x00, 0x10, 0x10, 0x00, 0x10,
0x08, 0x00, 0x20, 0x08, 0x00, 0x20, 0x08, 0x00, 0x20, 0x08, 0x00, 0x20,
0x08, 0x00, 0x20, 0x08, 0x00, 0x20, 0x08, 0x00, 0x20, 0x10, 0x00, 0x10,
0x10, 0x00, 0x10, 0x20, 0x00, 0x08, 0x40, 0x00, 0x04, 0x80, 0x01, 0x03,
0x00, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
{
0x00, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x80, 0x01, 0x03, 0x40, 0x00, 0x04,
0x20, 0x00, 0x08, 0x10, 0x00, 0x10, 0x08, 0x00, 0x20, 0x08, 0x00, 0x20,
0x04, 0x00, 0x40, 0x04, 0x00, 0x40, 0x04, 0x00, 0x40, 0x04, 0x00, 0x40,
0x04, 0x00, 0x40, 0x04, 0x00, 0x40, 0x04, 0x00, 0x40, 0x08, 0x00, 0x20,
0x08, 0x00, 0x20, 0x10, 0x00, 0x10, 0x20, 0x00, 0x08, 0x40, 0x00, 0x04,
0x80, 0x01, 0x03, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
{
0x00, 0xfe, 0x00, 0x80, 0x01, 0x03, 0x60, 0x00, 0x0c, 0x10, 0x00, 0x10,
0x08, 0x00, 0x20, 0x08, 0x00, 0x20, 0x04, 0x00, 0x40, 0x04, 0x00, 0x40,
0x02, 0x00, 0x80, 0x02, 0x00, 0x80, 0x02, 0x00, 0x80, 0x02, 0x00, 0x80,
0x02, 0x00, 0x80, 0x02, 0x00, 0x80, 0x02, 0x00, 0x80, 0x04, 0x00, 0x40,
0x04, 0x00, 0x40, 0x08, 0x00, 0x20, 0x08, 0x00, 0x20, 0x10, 0x00, 0x10,
0x60, 0x00, 0x0c, 0x80, 0x01, 0x03, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x00},
{
0x00, 0xff, 0x01, 0xc0, 0x00, 0x06, 0x30, 0x00, 0x18, 0x08, 0x00, 0x20,
0x08, 0x00, 0x20, 0x04, 0x00, 0x40, 0x04, 0x00, 0x40, 0x02, 0x00, 0x80,
0x02, 0x00, 0x80, 0x02, 0x00, 0x80, 0x02, 0x00, 0x80, 0x02, 0x00, 0x80,
0x02, 0x00, 0x80, 0x02, 0x00, 0x80, 0x02, 0x00, 0x80, 0x02, 0x00, 0x80,
0x04, 0x00, 0x40, 0x04, 0x00, 0x40, 0x08, 0x00, 0x20, 0x08, 0x00, 0x20,
0x30, 0x00, 0x18, 0xc0, 0x00, 0x06, 0x00, 0xff, 0x01, 0x00, 0x00, 0x00}};
#define emph_player_seq_width 24
#define emph_player_seq_height 24
#define emph_player_seq_frames 3
static char emph_player_seq_bits[emph_player_seq_frames][72] =
{
{
0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x08, 0x00, 0x80, 0x9c, 0x00,
0x80, 0xff, 0x00, 0xc0, 0xc1, 0x01, 0x60, 0x00, 0x03, 0x38, 0x00, 0x0e,
0x30, 0x00, 0x06, 0x10, 0x00, 0x04, 0x18, 0x00, 0x0c, 0x1e, 0x00, 0x3c,
0x18, 0x00, 0x0c, 0x10, 0x00, 0x04, 0x30, 0x00, 0x06, 0x38, 0x00, 0x0e,
0x60, 0x00, 0x03, 0xc0, 0xc1, 0x01, 0x80, 0xff, 0x00, 0x80, 0x9c, 0x00,
0x00, 0x08, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
{
0x00, 0x08, 0x00, 0x00, 0x08, 0x00, 0x40, 0x1c, 0x01, 0xc0, 0xff, 0x01,
0xc0, 0xff, 0x01, 0xe0, 0x80, 0x03, 0x7c, 0x00, 0x1f, 0x38, 0x00, 0x0e,
0x18, 0x00, 0x0c, 0x18, 0x00, 0x0c, 0x1c, 0x00, 0x1c, 0x1f, 0x00, 0x7c,
0x1c, 0x00, 0x1c, 0x18, 0x00, 0x0c, 0x18, 0x00, 0x0c, 0x38, 0x00, 0x0e,
0x7c, 0x00, 0x1f, 0xe0, 0x80, 0x03, 0xc0, 0xff, 0x01, 0xc0, 0xff, 0x01,
0x40, 0x1c, 0x01, 0x00, 0x08, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00},
{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}};
#define emph_player_seql_width 30
#define emph_player_seql_height 30
#define emph_player_seql_frames 3
static char emph_player_seql_bits[emph_player_seql_frames][120] =
{
{
0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x04, 0x00, 0x00, 0x18, 0x06, 0x00,
0x80, 0xfc, 0x4f, 0x00, 0x80, 0x0f, 0x7c, 0x00, 0xc0, 0x01, 0xe0, 0x00,
0x60, 0x00, 0x80, 0x01, 0x38, 0x00, 0x00, 0x07, 0x30, 0x00, 0x00, 0x03,
0x10, 0x00, 0x00, 0x02, 0x18, 0x00, 0x00, 0x06, 0x1e, 0x00, 0x00, 0x1e,
0x0c, 0x00, 0x00, 0x0c, 0x08, 0x00, 0x00, 0x04, 0x08, 0x00, 0x00, 0x04,
0x08, 0x00, 0x00, 0x04, 0x08, 0x00, 0x00, 0x04, 0x0c, 0x00, 0x00, 0x0c,
0x1e, 0x00, 0x00, 0x1e, 0x18, 0x00, 0x00, 0x06, 0x10, 0x00, 0x00, 0x02,
0x30, 0x00, 0x00, 0x03, 0x38, 0x00, 0x00, 0x07, 0x60, 0x00, 0x80, 0x01,
0xc0, 0x01, 0xe0, 0x00, 0x80, 0x0f, 0x7c, 0x00, 0x80, 0xfc, 0x4f, 0x00,
0x00, 0x18, 0x06, 0x00, 0x00, 0x08, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00},
{
0x00, 0x08, 0x04, 0x00, 0x00, 0x18, 0x06, 0x00, 0x40, 0xfc, 0x8f, 0x00,
0xc0, 0xff, 0xff, 0x00, 0xc0, 0x0f, 0xfc, 0x00, 0xe0, 0x00, 0xc0, 0x01,
0x7c, 0x00, 0x80, 0x0f, 0x38, 0x00, 0x00, 0x07, 0x18, 0x00, 0x00, 0x06,
0x18, 0x00, 0x00, 0x06, 0x1c, 0x00, 0x00, 0x0e, 0x1f, 0x00, 0x00, 0x3e,
0x0e, 0x00, 0x00, 0x1c, 0x0c, 0x00, 0x00, 0x0c, 0x0c, 0x00, 0x00, 0x0c,
0x0c, 0x00, 0x00, 0x0c, 0x0c, 0x00, 0x00, 0x0c, 0x0e, 0x00, 0x00, 0x1c,
0x1f, 0x00, 0x00, 0x3e, 0x1c, 0x00, 0x00, 0x0e, 0x18, 0x00, 0x00, 0x06,
0x18, 0x00, 0x00, 0x06, 0x38, 0x00, 0x00, 0x07, 0x7c, 0x00, 0x80, 0x0f,
0xe0, 0x00, 0xc0, 0x01, 0xc0, 0x0f, 0xfc, 0x00, 0xc0, 0xff, 0xff, 0x00,
0x40, 0xfc, 0x8f, 0x00, 0x00, 0x18, 0x06, 0x00, 0x00, 0x08, 0x04, 0x00},
{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}};