Index: head/games/xrobots/Makefile =================================================================== --- head/games/xrobots/Makefile (revision 397491) +++ head/games/xrobots/Makefile (revision 397492) @@ -1,25 +1,25 @@ # Created by: swallace # $FreeBSD$ PORTNAME= xrobots PORTVERSION= 1.0 -PORTREVISION= 4 +PORTREVISION= 5 CATEGORIES= games MASTER_SITES= http://www.mavetju.org/download/adopted/ DISTNAME= ${PORTNAME}-${PORTVERSION}-ss-10.20 MAINTAINER= edwin@mavetju.org COMMENT= Fight off villainous robots (X version) USES= imake USE_XORG= x11 xaw xext xmu xt sm ice WRKSRC= ${WRKDIR}/${PORTNAME}-${PORTVERSION} post-install: ${CP} ${FILESDIR}/xrobotscores ${STAGEDIR}${PREFIX}/lib/X11 -post-patch: +pre-build: ${REINPLACE_CMD} -e 's|__PREFIX__|${PREFIX}|g' \ ${WRKSRC}/xrobots.man ${WRKSRC}/Imakefile .include Index: head/games/xrobots/files/patch-actions.c =================================================================== --- head/games/xrobots/files/patch-actions.c (revision 397491) +++ head/games/xrobots/files/patch-actions.c (revision 397492) @@ -1,51 +1,100 @@ ---- actions.c.orig 2013-10-13 01:20:18.000000000 +1100 -+++ actions.c 2013-10-13 01:26:21.000000000 +1100 -@@ -66,6 +66,7 @@ +--- actions.c.orig 1989-11-17 22:37:37 UTC ++++ actions.c +@@ -37,6 +37,7 @@ + #include + #include + #include ++#include + #include "xrobots.h" + + extern Widget sonic_command; +@@ -66,6 +67,7 @@ do_nothing_action(w,event,params,num_par Cardinal *num_params; { /* do nothing */ + return NULL; } -@@ -169,11 +170,11 @@ +@@ -169,11 +171,11 @@ move_action(w,event,params,num_params) int diff_x, diff_y; int num_wasted; - if(!game_active) return; + if(!game_active) return NULL; if(get_next_position(&diff_x, &diff_y, event->x, event->y, params, *num_params)) - return; + return NULL; last_human_x = human_x; last_human_y = human_y; -@@ -210,14 +211,14 @@ +@@ -210,14 +212,14 @@ jump_action(w,event,params,num_params) int diff_x, diff_y; int num_wasted; - if(!game_active) return; + if(!game_active) return NULL; if(get_next_position(&diff_x, &diff_y, event->x, event->y, params, *num_params)) - return; + return NULL; if(! can_go(human_x+diff_x,human_y+diff_y) ) - return; + return NULL; while( can_go(human_x+diff_x,human_y+diff_y) ) { last_human_x = human_x; -@@ -261,7 +262,7 @@ +@@ -225,7 +227,7 @@ jump_action(w,event,params,num_params) + human_x += diff_x; + human_y += diff_y; + num_wasted = chase(0); +- if(showjumps) ++ if(app_data.showjumps) + show_movement(); + add_score(num_wasted); + if(!num_robots) +@@ -235,7 +237,7 @@ jump_action(w,event,params,num_params) + if(!num_robots) + new_level(); + else +- if(!showjumps) ++ if(!app_data.showjumps) + display_level(); + display_possible_moves(); + auto_teleport(); +@@ -261,7 +263,7 @@ go_here_action(w,event,params,num_params int tmp_human_x, tmp_human_y; int num_wasted; - if(!game_active) return; + if(!game_active) return NULL; while(direction = determine_direction(event->x,event->y)) { if(direction == STILL) break; +@@ -280,19 +282,19 @@ go_here_action(w,event,params,num_params + human_x = tmp_human_x; + human_y = tmp_human_y; + num_wasted = chase(0); +- if(showjumps) ++ if(app_data.showjumps) + show_movement(); + add_score(num_wasted); + if(!num_robots) + break; +- if(spiffy) ++ if(app_data.spiffy) + pointer_moved((Widget)0,(caddr_t)0,event); + XFlush(display); + } + if(!num_robots) + new_level(); + else +- if(!showjumps) ++ if(!app_data.showjumps) + display_level(); + display_possible_moves(); + auto_teleport(); Index: head/games/xrobots/files/patch-game.c =================================================================== --- head/games/xrobots/files/patch-game.c (nonexistent) +++ head/games/xrobots/files/patch-game.c (revision 397492) @@ -0,0 +1,40 @@ +--- game.c.orig 1995-03-27 12:14:34 UTC ++++ game.c +@@ -34,10 +34,8 @@ + * HP-UX :- following two defines + */ + +-#define srandom srand +-#define random rand +- + #include ++#include + #include "xrobots.h" + + /* some of these are global */ +@@ -281,7 +279,7 @@ wait_for_em() + /* backout of latest chase() and break loop */ + undo_chase(); + +- if(diewaiting) { /* for those risk takers out there */ ++ if(app_data.diewaiting) { /* for those risk takers out there */ + display_level(); + do_death(); + check_score(score); +@@ -294,14 +292,14 @@ wait_for_em() + add_score(num_wasted); + if(!num_robots) + break; +- if(showjumps) ++ if(app_data.showjumps) + show_movement(); + XFlush(display); + } + if(!num_robots) + new_level(); + else +- if(!showjumps) ++ if(!app_data.showjumps) + display_level(); + display_possible_moves(); + auto_teleport(); Property changes on: head/games/xrobots/files/patch-game.c ___________________________________________________________________ Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: head/games/xrobots/files/patch-graphics.c =================================================================== --- head/games/xrobots/files/patch-graphics.c (nonexistent) +++ head/games/xrobots/files/patch-graphics.c (revision 397492) @@ -0,0 +1,69 @@ +--- graphics.c.orig 1989-11-17 22:37:38 UTC ++++ graphics.c +@@ -79,8 +79,8 @@ init_pixmaps(top_shell) + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +- fgcolor.pixel = fg; +- bgcolor.pixel = bg; ++ fgcolor.pixel = app_data.fg; ++ bgcolor.pixel = app_data.bg; + fgcolor.flags = DoRed | DoGreen | DoBlue; + bgcolor.flags = DoRed | DoGreen | DoBlue; + XQueryColor(display,DefaultColormapOfScreen(XtScreen(playfield_widget)), &fgcolor); +@@ -156,11 +156,11 @@ auto_teleport() + { + if(!cant_move) + return; +- if(autoteleport && sonic_used) { ++ if(app_data.autoteleport && sonic_used) { + teleport(); + return; + } +- if(autoteleportalways) ++ if(app_data.autoteleportalways) + teleport(); + } + +@@ -171,12 +171,12 @@ display_ok_move(x,y) + + if(can_go(x,y)) { + cant_move = 0; +- if(!spiffy) return; ++ if(!app_data.spiffy) return; + /* show the icon for a good move */ + XDrawPoint(display, playfield, gc, + pos_to_coord(x)+CELLSIZE/2,pos_to_coord(y)+CELLSIZE/2); + } else { +- if(!spiffy) return; ++ if(!app_data.spiffy) return; + /* or erase any previous dross */ + if( INXRANGE(x) && INYRANGE(y) && (robot_array[x][y] == EMPTY)) + XClearArea(display, playfield, +@@ -370,7 +370,7 @@ void free_pixmaps() + XFreeCursor(display,stayC); + XFreeCursor(display,thumbsC); + XFreeCursor(display,cant_goC); +- for(i=0;i++;i0;i-=10) { + XDrawArc(display,playfield,gc, +@@ -430,7 +430,7 @@ int center_x = pos_to_coord(human_x)+(CE + center_y = pos_to_coord(human_y)+(CELLSIZE/2)-2; + int i; + +- if(!spiffy) return; ++ if(!app_data.spiffy) return; + + for(i=pos_to_coord(human_x-1);i ++#include ++#include + #include "xrobots.h" + +-#define srandom srand +-#define random rand +- + /*----------------------------------------------------------------------*/ + + Widget top_shell, top_widget, playfield_widget, score_command, sonic_command; +@@ -153,13 +153,7 @@ static XtActionsRec actions[] = { + {"do_nothing",(XtActionProc)do_nothing_action}, }; --static XtResource application_resources[] = { -+XtResource application_resources[] = { +-Pixel fg, bg; +-Boolean spiffy, /* limited graphics */ +- autoteleport, /* teleport when sonic used, and no moves */ +- autoteleportalways, /* teleport when no available moves */ +- showjumps, /* show no intermediate moves */ +- diewaiting; /* die if you use wait unsafely */ +-XtTranslations translations; ++AppData app_data; + + static XrmOptionDescRec options[] = { + {"-spiffy", "spiffy", XrmoptionSepArg, NULL }, +@@ -172,29 +166,30 @@ static XrmOptionDescRec options[] = { + + static XtResource application_resources[] = { {"foreground", "Foreground", XtRPixel, sizeof(Pixel), - (Cardinal)&fg, XtRString, (caddr_t) "Black"}, -+ NULL, XtRString, (caddr_t) "Black"}, ++ XtOffsetOf(AppData, fg), XtRString, (caddr_t) "Black"}, {"background", "Background", XtRPixel, sizeof(Pixel), - (Cardinal)&bg, XtRString, (caddr_t) "White"}, -+ NULL, XtRString, (caddr_t) "White"}, ++ XtOffsetOf(AppData, bg), XtRString, (caddr_t) "White"}, {"spiffy", "Spiffy", XtRBoolean, sizeof(Boolean), - (Cardinal)&spiffy, XtRString, (caddr_t) "True"}, -+ NULL, XtRString, (caddr_t) "True"}, ++ XtOffsetOf(AppData, spiffy), XtRString, (caddr_t) "True"}, {"autoteleport", "Autoteleport", XtRBoolean, sizeof(Boolean), - (Cardinal)&autoteleport, XtRString, (caddr_t) "False"}, -+ NULL, XtRString, (caddr_t) "False"}, ++ XtOffsetOf(AppData, autoteleport), XtRString, (caddr_t) "False"}, {"autoteleportalways", "Autoteleportalways", XtRBoolean, sizeof(Boolean), - (Cardinal)&autoteleportalways, XtRString, (caddr_t) "False"}, -+ NULL, XtRString, (caddr_t) "False"}, ++ XtOffsetOf(AppData, autoteleportalways), XtRString, (caddr_t) "False"}, {"showmovement", "Showmovement", XtRBoolean, sizeof(Boolean), - (Cardinal)&showjumps, XtRString, (caddr_t) "True"}, -+ NULL, XtRString, (caddr_t) "True"}, ++ XtOffsetOf(AppData, showjumps), XtRString, (caddr_t) "True"}, {"diewaiting", "Diewaiting", XtRBoolean, sizeof(Boolean), - (Cardinal)&diewaiting, XtRString, (caddr_t) "False"}, -+ NULL, XtRString, (caddr_t) "False"}, ++ XtOffsetOf(AppData, diewaiting), XtRString, (caddr_t) "False"}, {"translations","Translations", XtRTranslationTable, sizeof(XtTranslations), - (Cardinal)&translations, XtRString, (caddr_t)translations_str}, -+ NULL, XtRString, (caddr_t)translations_str}, ++ XtOffsetOf(AppData, translations), XtRString, (caddr_t)translations_str}, {"scorefile","Scorefile", XtRString, sizeof(String), - (Cardinal)&score_filename, XtRString, (caddr_t)SCORE_FILE}, -+ NULL, XtRString, (caddr_t)SCORE_FILE}, ++ XtOffsetOf(AppData, score_filename), XtRString, (caddr_t)SCORE_FILE}, }; /*----------------------------------------------------------------------*/ ++int main(argc, argv) - unsigned int argc; + int argc; char **argv; { Arg args[1]; -@@ -206,6 +206,16 @@ +@@ -212,7 +207,7 @@ main(argc, argv) - srandom(getpid()); + XtAddActions(actions,XtNumber(actions)); -+ application_resources[0].resource_offset=(Cardinal)&fg; -+ application_resources[1].resource_offset=(Cardinal)&bg; -+ application_resources[2].resource_offset=(Cardinal)&spiffy; -+ application_resources[3].resource_offset=(Cardinal)&autoteleport; -+ application_resources[4].resource_offset=(Cardinal)&autoteleportalways; -+ application_resources[5].resource_offset=(Cardinal)&showjumps; -+ application_resources[6].resource_offset=(Cardinal)&diewaiting; -+ application_resources[7].resource_offset=(Cardinal)&translations; -+ application_resources[8].resource_offset=(Cardinal)&score_filename; -+ - top_shell = XtInitialize(argv[0], "xrobots", options, XtNumber(options), - (int *)&argc, argv); - XtSetValues(top_shell, arglisttop_shell, XtNumber(arglisttop_shell)); +- XtGetApplicationResources(top_shell, 0, application_resources, ++ XtGetApplicationResources(top_shell, &app_data, application_resources, + XtNumber(application_resources), NULL, 0 ); + + top_widget = XtCreateManagedWidget( +@@ -228,7 +223,7 @@ main(argc, argv) + arglistplayfield, + XtNumber(arglistplayfield)); + +- XtAugmentTranslations(playfield_widget,translations); ++ XtAugmentTranslations(playfield_widget,app_data.translations); + + teleport_command = XtCreateManagedWidget( + "teleport_button", +@@ -292,12 +287,12 @@ main(argc, argv) + + display = XtDisplay(playfield_widget); + playfield = XtWindow(playfield_widget); +- gcv.foreground = fg; +- gcv.background = bg; ++ gcv.foreground = app_data.fg; ++ gcv.background = app_data.bg; + gcv.function = GXcopy; + gc = XCreateGC(display, playfield, + GCForeground | GCBackground | GCFunction, &gcv); +- gcv.foreground = bg; ++ gcv.foreground = app_data.bg; + cleargc = XCreateGC(display, playfield, + GCForeground | GCBackground | GCFunction, &gcv); + Index: head/games/xrobots/files/patch-score.c =================================================================== --- head/games/xrobots/files/patch-score.c (revision 397491) +++ head/games/xrobots/files/patch-score.c (revision 397492) @@ -1,91 +1,73 @@ -*** score.c.orig Thu Jan 22 09:58:52 1998 ---- score.c Sun Apr 12 14:00:32 1998 -*************** -*** 56,61 **** ---- 56,62 ---- - - #include /* brings in */ - #include -+ #include - #include "xrobots.h" - - /*----------------------------------------------------------------------*/ -*************** -*** 67,73 **** - - static SCORE scores[MAXSCORES]; - -! void show_scores(), - write_out_scores(); - - static void new_high_score(), ---- 68,74 ---- - - static SCORE scores[MAXSCORES]; - -! static void show_scores(), - write_out_scores(); - - static void new_high_score(), -*************** -*** 110,121 **** - #ifndef SYSV - flock(scorefile->_file, LOCK_EX); - #endif -! while( fgets(scores[i].score,6,scorefile) /* get score */ -! && fgets(scores[i].name,26,scorefile) /* get name */ -! && fgetc(scorefile)) /* and newline */ -! { -! i++; -! if( i > MAXSCORES ) break; - } - } - ---- 111,123 ---- - #ifndef SYSV - flock(scorefile->_file, LOCK_EX); - #endif -! for(i = 0; i < MAXSCORES; i++) { -! if(!fgets(scores[i].score, 6, scorefile)) /* get score */ -! break; -! if(!fgets(scores[i].name, 26, scorefile)) /* get name */ -! break; -! if(!fgetc(scorefile)) /* and newline */ -! break; - } - } - -*************** -*** 194,200 **** - - - /*ARGSUSED*/ -! static XtCallbackProc - popdown_callback(w, closure, call_data) - Widget w; - caddr_t closure; ---- 196,202 ---- - - - /*ARGSUSED*/ -! static void - popdown_callback(w, closure, call_data) - Widget w; - caddr_t closure; -*************** -*** 253,259 **** - show_scores() - { - int i; -! char tmp_str[31]; - Arg tmp_arg; - - for(i = 0;i /* brings in */ + #include ++#include + #include "xrobots.h" + + /*----------------------------------------------------------------------*/ +@@ -67,14 +68,13 @@ typedef struct { + + static SCORE scores[MAXSCORES]; + +-void show_scores(), ++static void show_scores(), + write_out_scores(); + + static void new_high_score(), + load_scores(); + + static FILE *scorefile = 0; +-char *score_filename; + + /*----------------------------------------------------------------------*/ + +@@ -103,19 +103,20 @@ static void load_scores() + { + int i = 0; + +- if( !(scorefile = fopen(score_filename,"r+")) ) { +- scorefile = fopen(score_filename, "w"); ++ if( !(scorefile = fopen(app_data.score_filename,"r+")) ) { ++ scorefile = fopen(app_data.score_filename, "w"); + return; + } + #ifndef SYSV + flock(scorefile->_file, LOCK_EX); + #endif +- while( fgets(scores[i].score,6,scorefile) /* get score */ +- && fgets(scores[i].name,26,scorefile) /* get name */ +- && fgetc(scorefile)) /* and newline */ +- { +- i++; +- if( i > MAXSCORES ) break; ++ for(i = 0; i < MAXSCORES; i++) { ++ if(!fgets(scores[i].score, 6, scorefile)) /* get score */ ++ break; ++ if(!fgets(scores[i].name, 26, scorefile)) /* get name */ ++ break; ++ if(!fgetc(scorefile)) /* and newline */ ++ break; + } + } + +@@ -194,7 +195,7 @@ static Arg arglist_popdown[] = { + + + /*ARGSUSED*/ +-static XtCallbackProc ++static void + popdown_callback(w, closure, call_data) + Widget w; + caddr_t closure; +@@ -253,7 +254,7 @@ void + show_scores() + { + int i; +- char tmp_str[31]; ++ char tmp_str[64]; + Arg tmp_arg; + + for(i = 0;ib)?a:b) -- - #define INXRANGE( _x_ ) (((_x_) >=0) && ((_x_)=0) && ((_y_)b)?a:b) +- + #define INXRANGE( _x_ ) (((_x_) >=0) && ((_x_)=0) && ((_y_)