Subversion Repositories HelenOS-historic

Compare Revisions

Ignore whitespace Rev 1419 → Rev 1454

/uspace/trunk/tetris/tetris.h
167,7 → 167,7
#define PRE_PENALTY 0.75
 
extern int score; /* the obvious thing */
extern gid_t gid, egid;
//extern gid_t gid, egid;
 
extern char key_msg[100];
extern int showpreview;
/uspace/trunk/tetris/tetris.c
50,7 → 50,7
#include <sys/types.h>
 
#include <err.h>
#include <signal.h>
//#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
67,7 → 67,7
const struct shape *nextshape;
long fallrate;
int score;
gid_t gid, egid;
//gid_t gid, egid;
char key_msg[100];
int showpreview, classic;
 
165,48 → 165,49
 
keys = "jkl pq";
 
gid = getgid();
egid = getegid();
setegid(gid);
// gid = getgid();
// egid = getegid();
// setegid(gid);
 
classic = showpreview = 0;
while ((ch = getopt(argc, argv, "ck:l:ps")) != -1)
switch(ch) {
case 'c':
/*
* this means:
* - rotate the other way;
* - no reverse video.
*/
classic = 1;
break;
case 'k':
if (strlen(keys = optarg) != 6)
usage();
break;
case 'l':
level = (int)strtonum(optarg, MINLEVEL, MAXLEVEL,
&errstr);
if (errstr)
errx(1, "level must be from %d to %d",
MINLEVEL, MAXLEVEL);
break;
case 'p':
showpreview = 1;
break;
case 's':
showscores(0);
exit(0);
default:
usage();
}
 
argc -= optind;
argv += optind;
/* while ((ch = getopt(argc, argv, "ck:l:ps")) != -1) */
/* switch(ch) { */
/* case 'c': */
/* /\* */
/* * this means: */
/* * - rotate the other way; */
/* * - no reverse video. */
/* *\/ */
/* classic = 1; */
/* break; */
/* case 'k': */
/* if (strlen(keys = optarg) != 6) */
/* usage(); */
/* break; */
/* case 'l': */
/* level = (int)strtonum(optarg, MINLEVEL, MAXLEVEL, */
/* &errstr); */
/* if (errstr) */
/* errx(1, "level must be from %d to %d", */
/* MINLEVEL, MAXLEVEL); */
/* break; */
/* case 'p': */
/* showpreview = 1; */
/* break; */
/* case 's': */
/* showscores(0); */
/* exit(0); */
/* default: */
/* usage(); */
/* } */
 
if (argc)
usage();
/* argc -= optind; */
/* argv += optind; */
 
/* if (argc) */
/* usage(); */
 
fallrate = 1000000 / level;
 
for (i = 0; i <= 5; i++) {
227,7 → 228,7
key_write[0], key_write[1], key_write[2], key_write[3],
key_write[4], key_write[5]);
 
(void)signal(SIGINT, onintr);
// (void)signal(SIGINT, onintr);
scr_init();
setup_board();
 
357,13 → 358,13
exit(0);
}
 
void
onintr(int signo)
{
scr_clear(); /* XXX signal race */
scr_end(); /* XXX signal race */
_exit(0);
}
/* void */
/* onintr(int signo) */
/* { */
/* scr_clear(); /\* XXX signal race *\/ */
/* scr_end(); /\* XXX signal race *\/ */
/* _exit(0); */
/* } */
 
void
usage(void)
/uspace/trunk/tetris/Makefile
1,18 → 1,35
# $OpenBSD: Makefile,v 1.7 2002/05/31 03:46:35 pjanzen Exp $
LIBC_PREFIX = ../libc
SOFTINT_PREFIX = ../softint
include $(LIBC_PREFIX)/Makefile.toolchain
 
PROG= tetris
SRCS= input.c screen.c shapes.c scores.c tetris.c
MAN= tetris.6
DPADD= ${LIBCURSES}
LDADD= -lcurses
BINMODE=2555
LIBS = $(LIBC_PREFIX)/libc.a
 
beforeinstall:
@if [ ! -f ${DESTDIR}/var/games/tetris.scores ]; then \
${INSTALL} ${INSTALL_COPY} -o ${BINOWN} -g ${BINGRP} -m 664 \
/dev/null ${DESTDIR}/var/games/tetris.scores ; \
else \
true ; \
fi
OUTPUT = tetris
SOURCES = shapes.c tetris.c scores.c input.c screen.c
OBJECTS := $(addsuffix .o,$(basename $(SOURCES)))
 
.include <bsd.prog.mk>
.PHONY: all clean depend disasm
 
all: $(OUTPUT)
 
-include Makefile.depend
 
depend:
$(CC) $(DEFS) $(CFLAGS) -M $(SOURCES) > Makefile.depend
 
$(OUTPUT): $(OBJECTS) $(LIBS)
$(LD) -T $(LIBC_PREFIX)/arch/$(ARCH)/_link.ld $(OBJECTS) $(LIBS) $(LFLAGS) -o $@ -Map $(OUTPUT).map
 
clean:
-rm -f $(OUTPUT) $(OUTPUT).map $(OUTPUT).disasm Makefile.depend *.o
disasm:
$(OBJDUMP) -d $(OUTPUT) >$(OUTPUT).disasm
 
%.o: %.S
$(CC) $(DEFS) $(AFLAGS) $(CFLAGS) -D__ASM__ -c $< -o $@
 
%.o: %.s
$(AS) $(AFLAGS) $< -o $@
 
%.o: %.c
$(CC) $(DEFS) $(CFLAGS) -c $< -o $@