ftp.nice.ch/pub/next/games/action/Tetris1.3.N.bs.tar.gz#/Tetris1.3/Source/Piece.h

This is Piece.h in view mode; [Download] [Up]

#import <objc/Object.h>

#define MAX_SHAPE_SIZE	4
#define PIECE_INFO_NULL	(struct pieceInfo *)0
#define NUM_BITMAPS	4

struct shape {
    unsigned char table[4][4];
    unsigned char bounds[4];
    unsigned char points[4];
};

struct pieceInfo {
    id bitmap;
    int shape;
    int rotation;
};

@interface Piece:Object
{
    int curRow, curCol;			  // The Block's position
    id bitmap;						  // The image used to build the block
    unsigned char *currentPiece;
    struct shape *currentShape;
    int shapenum;					  // The Shape that we are currently dropping
    int currentRotation;
    int dropPoints;				  // Bonus points for dropping the piece
    NXSize blockSize;
    NXSize intercell;
    NXRect invalidRect;

    BOOL viewVarsInited;
    id anmShape;
    id anmBackground;			  // The animation background
    struct shape shapes[7];
	 id blockImage[NUM_BITMAPS]; // Holds the id for each block image.
}

- init;

- draw:sender;
- (BOOL)reset:sender piece:(struct pieceInfo *)info;
- newPiece;
- (struct pieceInfo *)pieceInfo;
- setPiece:(struct pieceInfo *)info;

- (BOOL)legalMove:sender :(int)row :(int)column rotation:(int)rotation;

- left:sender;
- right:sender;

- getInvalidRect:(NXRect *)aRect for:sender;
- point:(NXPoint *)thePoint for:(int)row :(int)column;
- (int)points;
- getBlockSize:(NXSize *) size;
- getBlockImage:(int) blockNum;

- drop:sender;
- (BOOL)down:sender;
- turn:sender;
- stick:sender;

- (int)getCurRow;

- free;

@end

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.