X-Git-Url: http://git.shiar.net/netris.git/blobdiff_plain/45dc9d995860486f1758dcf79fd2d8cd8dfb210a..0e779d807aa1830dde2f4a75117fd16f5627dc76:/netris.h diff --git a/netris.h b/netris.h index a361c2f..cab651c 100644 --- a/netris.h +++ b/netris.h @@ -19,18 +19,17 @@ * $Id: netris.h,v 1.28 1999/05/16 06:56:29 mhw Exp $ */ -#ifndef NETRIS_H -#define NETRIS_H +#ifndef __NETRIS_H +#define __NETRIS_H #include "config.h" + #include #include #include #include -#define version_string "0.7.821" - -#define ExtFunc /* Marks functions that need prototypes */ +#define version_string "0.8" #ifdef NOEXT //prevent re-declaration # define EXT @@ -61,7 +60,6 @@ typedef long netint4; /* Protocol versions */ #define MAJOR_VERSION 1 #define PROTOCOL_VERSION 4 -#define ROBOT_VERSION 1 #define DEFAULT_PORT 9284 /* Very arbitrary */ @@ -79,7 +77,6 @@ typedef long netint4; #define EM_alarm 000001 #define EM_key 000002 #define EM_net 000004 -#define EM_robot 000010 #define EM_connect 000020 #define EM_any 000777 @@ -93,7 +90,7 @@ typedef enum _Dir { D_down, D_right, D_up, D_left } Dir; typedef enum _Cmd { C_end, C_forw, C_back, C_left, C_right, C_plot } Cmd; typedef enum _FDType { FT_read, FT_write, FT_except, FT_len } FDType; typedef enum _MyEventType { - E_none, E_alarm, E_key, E_connect, E_net, E_lostConn, E_robot, E_lostRobot + E_none, E_alarm, E_key, E_connect, E_net, E_lostConn } MyEventType; typedef enum _NetPacketType { NP_endConn, //client/server quits @@ -110,6 +107,8 @@ typedef enum _NetPacketType { NP_argghhh, //player died NP_part, //player left + NP_msg, //chat message + NP_newPiece, //new piece info NP_rotright, //rotate piece clockwise NP_rotleft, //rotate piece counterclockwise @@ -123,18 +122,17 @@ typedef enum _NetPacketType { NP_giveJunk //player has to add junk } NetPacketType; -typedef signed char BlockType; - +typedef struct { + short sender, uid; + NetPacketType type; + int size; + void *data; +} _netEvent; typedef struct _MyEvent { MyEventType type; union { char key; - struct { - short sender, uid; - NetPacketType type; - int size; - void *data; - } net; + _netEvent net; struct { int size; char *data; @@ -160,27 +158,13 @@ typedef struct _EventGenRec { MyEventType NetGenFunc(EventGenRec *gen, MyEvent *event); typedef struct _Shape { - struct _Shape *rotateTo, *rotateFrom; - int initY, initX, mirrored; - Dir initDir; - BlockType type; - Cmd *cmds; + char shape, rotate; } Shape; -typedef struct _ShapeOption { - float weight; - Shape *shape; -} ShapeOption; - -typedef int (*ShapeDrawFunc)(int scr, int y, int x, - BlockType type, void *data); - /* NP_startConn flags */ -#define SCF_usingRobot 000001 -#define SCF_fairRobot 000002 -#define SCF_paused 000004 +#define SCF_paused 1 -typedef struct _Player { +typedef struct { int alive; char name[16]; int flags; @@ -188,16 +172,15 @@ typedef struct _Player { int dropmode; int boardHeight, boardWidth, boardVisible; int curX, curY; - Shape *curShape, *nextShape; + char curShape, nextShape; struct _Score { short level; long score; - int drops, lines, adds; + int pieces, lines, adds; } score; - char host[256]; //last-1 - int spy,small; //last -} Player; -EXT Player Players[MAX_SCREENS]; + char host[256]; //last +} _Player; +EXT _Player Players[MAX_SCREENS]; EXT short me; EXT short maxPlayer; EXT int spied; //in player.flags @@ -206,31 +189,23 @@ EXT int spied; //in player.flags #define SPEEDINC 1.2 #define SPEEDMINIMUM 40000 -typedef struct __Game { - int maxplayers; //1 +typedef struct { + int gravity; //1 int started; //2 int continuous; //3 long seed; //4 int initspeed; //5 int speed; - int standout, color, ascii; } _Game; EXT _Game Game; -EXT GameType game; -EXT int robotEnable, robotVersion, fairRobot; -EXT int protocolVersion; - -EXT int initConn; -EXT short port; - -EXT char scratch[1024]; +#define MSG_WIDTH 128 -extern ShapeOption stdOptions[]; +EXT GameType game; // => Game.type -#include "proto.h" +EXT short port; // => just in game.c, parameter to inet connect -#endif /* NETRIS_H */ +#endif //__NETRIS_H /* * vi: ts=4 ai