};
static char *hostStr;
-static int paused = 0;
+static bool paused = 0;
static char lastadd;
-void handle_setkeys(char *newKeys)
+static void handle_setkeys(char *newKeys)
{
int i, k, ch;
char used[256];
exit(1);
}
-void Usage(void)
+static void Usage(void)
{
Header();
fprintf(stderr,
" -t, --team <team>\tJoin a team (don't receive lines from your teammates)\n"
" -l, --level <lvl>\tBegin at a higher level (can be used as handicap)\n"
" -k, --keys <keys>\tRemap keys (default is \"%s\" for cursors)\n"
- "\n"
- " -r, --robot <cmd>\tExecute program to control the game instead of keyboard\n"
- " -F, --fair-robot\tUse fair robot interface\n"
"\n",
DEFAULT_PORT, DEFAULT_KEYS
);
}
-void handle_arg(char tag, char *value)
+static void handle_arg(char tag, char *value)
{
switch (tag) {
case 'a': //ascii
Sets.drawstyle &= ~Sets.ascii;
break;
case 'c': //connect
- game = GT_classicTwo;
+ Game.type = GT_classicTwo;
hostStr = value;
break;
case 'p': //port
}
}
-void handle_conffile(char *filename)
+static void handle_conffile(char *filename)
{
FILE *file_in;
char buf[513];
} //defaults
}
-int game_piece(int scr, char shape)
+static int game_piece(int scr, char shape)
{
Players[scr].score.pieces++;
{
return 1;
}
-void game_setpaused(void)
+static void game_setpaused(void)
{ //check whether anyone paused the game
int i;
paused = Game.started < 1;
for (i = 1; i < MAX_SCREENS; i++) if (Players[i].alive > 0)
- paused |= Players[i].flags & SCF_paused;
- if (paused) paused = 1;
+ paused |= (Players[i].flags & SCF_paused) != 0;
}
-void game_reset(void)
+static void game_reset(void)
{ //init new game
int i;
InitFields();
}
-void game_clear(int scr)
+static void game_clear(int scr)
{ //check for full lines
int linesCleared;
int linevalues[] = { 40, 100, 400, 1200, }; //= 50*lines! - 10*(lines==1)
2500, 3000, 3500, 4000, 4500, 5000, 6000, 7500 };
if ((linesCleared = ClearFullLines(scr)) > 0) {
- if (game == GT_onePlayer)
+ if (Game.type == GT_onePlayer)
if ((Players[scr].score.lines / 10) <
((Players[scr].score.lines+linesCleared)/10)) {
if ((Game.speed /= SPEEDINC) < SPEEDMINIMUM)
Players[scr].score.lines += linesCleared;
Players[scr].score.adds += linesCleared - (linesCleared < 4); //XXX match handicap
if (scr == me) {
- if (game == GT_classicTwo) {
+ if (Game.type == GT_classicTwo) {
SendPacket(scr, NP_clear, 0, NULL);
if (linesCleared > 1) {
short junkLines;
} //lines cleared
}
-void game_loop(void)
+static void game_loop(void)
{
bool changed = 0;
short gameStatus = 2; //2=loop; 1=new piece; 0=quit
Message(Players[me].flags & SCF_paused
? "You are not ready" : "You are ready");
game_setpaused();
- if (game == GT_classicTwo)
+ if (Game.type == GT_classicTwo)
SendPacket(me, NP_pause, 0, NULL);
ShowPause(me);
changed = 1;
Message("<\\%d%s\\7> %s",
Players[me].team > 7 ? 7 : Players[me].team,
Players[me].name, chatText);
- if (game == GT_classicTwo)
+ if (Game.type == GT_classicTwo)
SendPacket(me, NP_msg, strlen(chatText) + 1, chatText);
}
gameStatus = 1; // drop
break;
case KT_faster:
- if (game != GT_onePlayer) break;
+ if (Game.type != GT_onePlayer) break;
if ((Game.speed /= SPEEDINC) < SPEEDMINIMUM)
Game.speed = SPEEDMINIMUM;
SetITimer(Game.speed, SetITimer(0, 0));
} //stop game
case NP_newPlayer:
{
- char teams[10][7] = { "", "Green", "Cyan", "Blue", "Purple",
- "Red", "Grey", "White", "*Orange" };
-
if (net.uid>maxPlayer) maxPlayer = net.uid;
memcpy(&Players[net.uid], net.data, net.size);
ClearField(net.uid);
Message("%s joined the game", Players[net.uid].name);
else
Message("%s joined %s team", Players[net.uid].name,
- teams[Players[net.uid].team]);
+ teamname[Players[net.uid].team]);
if (Players[net.uid].flags & SCF_paused) {
game_setpaused();
} //player has paused
else Message("\\%d%s fragged you",
Players[lastadd].team > 7 ? 7 : Players[lastadd].team,
Players[lastadd].name);
- if (game == GT_classicTwo)
+ if (Game.type == GT_classicTwo)
SendPacket(me, NP_argghhh, sizeof(lastadd), &lastadd);
ShowPause(me);
changed = 1;
{
char ch;
- game = GT_onePlayer;
+ Game.type = GT_onePlayer;
port = DEFAULT_PORT;
maxPlayer = 1;
Game.initspeed = DEFAULT_INTERVAL;
InitScreens(); //setup screen
- if (game == GT_classicTwo) {
+ if (Game.type == GT_classicTwo) {
spied = 1;
InitiateConnection(hostStr, port);
HandShake();