svn commit: r548113 - head/games/xboing/files
Dirk Meyer
dinoex at FreeBSD.org
Wed Sep 9 18:02:25 UTC 2020
Author: dinoex
Date: Wed Sep 9 18:02:22 2020
New Revision: 548113
URL: https://svnweb.freebsd.org/changeset/ports/548113
Log:
- fix build with -fno-common
- merge patches
Added:
head/games/xboing/files/patch-demo.c (contents, props changed)
head/games/xboing/files/patch-editor.c (contents, props changed)
head/games/xboing/files/patch-file.c (contents, props changed)
head/games/xboing/files/patch-inst.c (contents, props changed)
head/games/xboing/files/patch-intro.c (contents, props changed)
head/games/xboing/files/patch-keys.c (contents, props changed)
head/games/xboing/files/patch-main.c (contents, props changed)
head/games/xboing/files/patch-misc.c (contents, props changed)
head/games/xboing/files/patch-presents.c (contents, props changed)
head/games/xboing/files/patch-preview.c (contents, props changed)
Deleted:
head/games/xboing/files/patch-debian
Modified:
head/games/xboing/files/patch-Imakefile
head/games/xboing/files/patch-LINUXaudio.c
head/games/xboing/files/patch-ball.c
head/games/xboing/files/patch-bonus.c
head/games/xboing/files/patch-highscore.c
head/games/xboing/files/patch-init.c
head/games/xboing/files/patch-xboing.man
Modified: head/games/xboing/files/patch-Imakefile
==============================================================================
--- head/games/xboing/files/patch-Imakefile Wed Sep 9 17:56:21 2020 (r548112)
+++ head/games/xboing/files/patch-Imakefile Wed Sep 9 18:02:22 2020 (r548113)
@@ -1,6 +1,6 @@
---- Imakefile.orig 1996-11-22 02:28:46.000000000 +0100
-+++ Imakefile 2014-03-30 17:51:01.000000000 +0200
-@@ -24,23 +24,28 @@
+--- Imakefile.orig 1996-11-22 01:28:46 UTC
++++ Imakefile
+@@ -24,23 +24,28 @@ XCOMM ================================================
XCOMM This is the directory where the highscore, level & sound data will be
XCOMM placed. Default will be the current directory.
@@ -33,7 +33,7 @@
XCOMM Uncomment this if you want to use ANY of the AUDIO sound systems
#define COMPILE_IN_AUDIO
-@@ -132,8 +137,8 @@
+@@ -132,8 +137,8 @@ XCOMM hasn't a usleep() function.
-DLEVEL_INSTALL_DIR=\"$(LEVEL_INSTALL_DIR)\" \
-DAUDIO_AVAILABLE=\"$(AUDIO_AVAILABLE)\" \
-DSOUNDS_DIR=\"$(SOUNDS_DIR)\" \
@@ -44,7 +44,7 @@
XCOMM -DNEED_USLEEP=\"True\" \
XCOMM -DNO_LOCKING=\"True\"
-@@ -182,30 +187,30 @@
+@@ -182,30 +187,30 @@ install:: $(PROGRAMS)
@echo "XBoing directory is " $(XBOING_DIR)
@:
@echo "Creating directory " $(XBOING_DIR)
Modified: head/games/xboing/files/patch-LINUXaudio.c
==============================================================================
--- head/games/xboing/files/patch-LINUXaudio.c Wed Sep 9 17:56:21 2020 (r548112)
+++ head/games/xboing/files/patch-LINUXaudio.c Wed Sep 9 18:02:22 2020 (r548113)
@@ -1,5 +1,5 @@
---- audio/LINUXaudio.c.orig Fri Nov 22 02:28:33 1996
-+++ audio/LINUXaudio.c Tue Mar 4 22:06:01 2003
+--- audio/LINUXaudio.c.orig 1996-11-22 01:28:33 UTC
++++ audio/LINUXaudio.c
@@ -55,7 +55,7 @@
#include <unistd.h>
#include <stdio.h>
@@ -9,7 +9,7 @@
#include "include/error.h"
#include "include/audio.h"
-@@ -78,7 +78,7 @@
+@@ -78,7 +78,7 @@ static int snd_pipes[2];
*/
static char *Audio_dev = "/dev/audio";
@@ -18,7 +18,7 @@
/* size should depend on sample_rate */
static unsigned char buf[BUFFER_SIZE];
static char errorString[255];
-@@ -125,13 +125,14 @@
+@@ -125,13 +125,14 @@ int SetUpAudioSystem(display)
if (!strcmp(string, "EXIT"))
{
/* Make sure that the audio device is flushed and reset */
@@ -34,7 +34,7 @@
{
continue;
}
-@@ -185,6 +186,7 @@
+@@ -185,6 +186,7 @@ int SetUpAudioSystem(display)
/* Close the sound file */
(void) close(ifd);
(void) close(Audio_fd);
Modified: head/games/xboing/files/patch-ball.c
==============================================================================
--- head/games/xboing/files/patch-ball.c Wed Sep 9 17:56:21 2020 (r548112)
+++ head/games/xboing/files/patch-ball.c Wed Sep 9 18:02:22 2020 (r548113)
@@ -1,5 +1,5 @@
---- ball.c.old Mon Sep 23 12:48:00 2002
-+++ ball.c Mon Sep 23 12:48:09 2002
+--- ball.c.orig 1996-11-22 01:28:46 UTC
++++ ball.c
@@ -50,7 +50,7 @@
#include <stdio.h>
#include <stdlib.h>
Modified: head/games/xboing/files/patch-bonus.c
==============================================================================
--- head/games/xboing/files/patch-bonus.c Wed Sep 9 17:56:21 2020 (r548112)
+++ head/games/xboing/files/patch-bonus.c Wed Sep 9 18:02:22 2020 (r548113)
@@ -1,6 +1,15 @@
---- bonus.c.orig Thu Nov 20 03:12:56 1997
-+++ bonus.c Thu Nov 20 03:15:32 1997
-@@ -311,7 +311,7 @@
+--- bonus.c.orig 1996-11-22 01:28:46 UTC
++++ bonus.c
+@@ -120,7 +120,7 @@ enum BonusStates BonusState;
+ static Pixmap titlePixmap, titlePixmapM;
+ static int ypos;
+ static int waitingFrame;
+-enum BonusStates waitMode;
++extern enum BonusStates waitMode;
+ static char string[80];
+ static u_long bonusScore;
+ static int firstTime = True;
+@@ -311,7 +311,7 @@ void DrawTitleText(display, window)
XFlush(display);
SetBonusWait(BONUS_SCORE, frame + 5);
@@ -9,7 +18,7 @@
DEBUG("set bonus mode to BONUS_SCORE.")
}
-@@ -326,7 +326,7 @@
+@@ -326,7 +326,7 @@ static void DoScore(display, window)
{
DEBUG("in function DoScore() in bonus.c")
@@ -18,7 +27,7 @@
/* Nice message rewarding you for your efforts */
strcpy(string, "Congratulations on finishing this level.");
-@@ -336,7 +336,7 @@
+@@ -336,7 +336,7 @@ static void DoScore(display, window)
ypos += (35 + GAP);
SetBonusWait(BONUS_BONUS, frame + LINE_DELAY);
@@ -27,7 +36,7 @@
DEBUG("set bonus mode to BONUS_BONUS.")
}
-@@ -387,7 +387,7 @@
+@@ -387,7 +387,7 @@ static void DoBonuses(display, window)
DrawShadowCentredText(display, window, textFont,
string, ypos, blue, TOTAL_WIDTH);
@@ -36,7 +45,7 @@
/* Now skip to the next sequence */
SetBonusWait(BONUS_LEVEL, frame + LINE_DELAY);
-@@ -411,7 +411,7 @@
+@@ -411,7 +411,7 @@ static void DoBonuses(display, window)
bonusScore += ComputeScore(SUPER_BONUS_SCORE);
DisplayScore(display, scoreWindow, bonusScore);
@@ -45,7 +54,7 @@
/* Now skip to the next sequence */
SetBonusWait(BONUS_LEVEL, frame + LINE_DELAY);
-@@ -454,7 +454,7 @@
+@@ -454,7 +454,7 @@ static void DoBonuses(display, window)
ypos += (int) (textFont->ascent + GAP * 1.5);
firstTime = True;
@@ -54,7 +63,7 @@
}
}
-@@ -468,7 +468,7 @@
+@@ -468,7 +468,7 @@ static void DoLevel(display, window)
{
int secs, theLevel;
@@ -63,7 +72,7 @@
/* Get the number of seconds left on the clock */
secs = GetLevelTimeBonus();
-@@ -533,7 +533,7 @@
+@@ -533,7 +533,7 @@ static void DoBullets(display, window)
/* Play the sound for the super bonus */
if (noSound == False) playSoundFile("Doh3", 80);
@@ -72,7 +81,7 @@
/* Get ready for the next sequence */
SetBonusWait(BONUS_TIME, frame + LINE_DELAY);
-@@ -569,7 +569,7 @@
+@@ -569,7 +569,7 @@ static void DoBullets(display, window)
SetBonusWait(BONUS_TIME, frame + LINE_DELAY);
ypos += (textFont->ascent + GAP/2);
firstTime = True;
@@ -81,7 +90,7 @@
}
}
-@@ -583,7 +583,7 @@
+@@ -583,7 +583,7 @@ static void DoTimeBonus(display, window)
{
int secs = 0;
@@ -90,7 +99,7 @@
/* Get the number of seconds left on the clock */
secs = GetLevelTimeBonus();
-@@ -627,7 +627,7 @@
+@@ -627,7 +627,7 @@ static void DoHighScore(display, window)
int myrank = 0;
char str[5];
@@ -99,7 +108,7 @@
/* Obtain current ranking for this score */
myrank = GetHighScoreRanking(score);
-@@ -680,7 +680,7 @@
+@@ -680,7 +680,7 @@ static void DoEndText(display, window)
{
DEBUG("DoEndText in bonus screen.")
@@ -108,349 +117,3 @@
/* Finishing sentence - so you know what level to do */
sprintf(string, "Prepare for level %ld", level+1);
---- main.c.orig Thu Nov 20 03:15:34 1997
-+++ main.c Thu Nov 20 03:15:54 1997
-@@ -156,7 +156,7 @@
-
- /* Set an entire game speedup or slowdown speed */
- temp = (speed / (long) userDelay);
-- userDelay = delay;
-+ userDelay = delay/2 + 3;
- speed = (long) (temp * userDelay);
- speedLevel = 10 - delay;
- }
---- misc.c.orig Fri Nov 22 09:28:46 1996
-+++ misc.c Thu Nov 20 03:18:15 1997
-@@ -89,8 +89,8 @@
- #ifdef SYSV
- #ifdef __clipper__
- struct timeval tv;
-- tv.tv_sec=((usec)/1000);
-- tv.tv_usec=(((usec)%1000)*1000);
-+ tv.tv_sec=((usec)/1000000);
-+ tv.tv_usec=((usec)%1000000);
- select(1,NULL,NULL,NULL,&tv);
- #else
- poll((struct poll *) 0, (size_t) 0, usec / 1000); /* ms resolution */
-@@ -105,6 +105,68 @@
- #endif
-
- #if NeedFunctionPrototypes
-+static int kudelay(unsigned long count)
-+#else
-+static int kudelay(count)
-+unsigned long count;
-+#endif
-+{
-+ unsigned int bluff = 1;
-+
-+ while( count-- != 0 ) /* this can hardly be "optimised out" */
-+ bluff = (bluff ^ ((bluff & 1) * 0x6110)) >> 1;
-+
-+ return( bluff );
-+}
-+
-+#if NeedFunctionPrototypes
-+static void kusleep(unsigned long usec)
-+#else
-+static void kusleep(usec)
-+ unsigned long usec;
-+#endif
-+{
-+ static float kuliber_time = 0.0;
-+ static float kuliber_count = 0.0;
-+ static unsigned long kutimerswap = (1000000 / 15);
-+ struct timeval st, et;
-+ long gap;
-+ unsigned long count;
-+
-+ if( kuliber_time == 0.0 )
-+ {
-+ count = 0x1000; /* calibrate delay loop */
-+ gettimeofday(&st, NULL);
-+
-+ while( True )
-+ {
-+ kudelay( count );
-+ count = (count << 1);
-+ gettimeofday(&et, NULL);
-+ gap = (((et.tv_sec - st.tv_sec) * 1000000) +
-+ (et.tv_usec - st.tv_usec) );
-+
-+ if( gap > 400*1000 )
-+ break;
-+ }
-+
-+ kuliber_time = (float)(gap/4);
-+ kuliber_count = (float)(((count-1)&~0xFFF)>>2);
-+ }
-+
-+ if( usec > kutimerswap )
-+ {
-+ kutimerswap = (1000000 / 30);
-+ usleep( usec ); /* using usleep() for low resolution only */
-+ }
-+ else
-+ {
-+ kutimerswap = (1000000 / 15);
-+ kudelay( (unsigned long)(kuliber_count*((float)usec/kuliber_time)) );
-+ }
-+}
-+
-+#if NeedFunctionPrototypes
- void sleepSync(Display *display, unsigned long ms)
- #else
- void sleepSync(display, ms)
-@@ -112,27 +174,85 @@
- unsigned long ms;
- #endif
- {
-- struct timeval st, et;
-- long SyncTime;
-- static unsigned long accu;
-+ static long Expected_time = 0;
-+ static long Ref_sec = 0;
-+ static long Ref_usec = 0;
-+ static long Sleeping_time = 0;
-+ static int PLL_filter = 0;
-+ struct timeval st;
-+ long elapsed;
-+ long dodelay;
-+ float x;
-
-- gettimeofday(&st, NULL);
- XSync(display, False);
-- gettimeofday(&et, NULL);
-
-- SyncTime = (((et.tv_sec - st.tv_sec) * 1000) +
-- ((et.tv_usec - st.tv_usec) / 1000) );
-+ gettimeofday(&st, NULL);
-+
-+ if( Ref_sec == 0 )
-+ {
-+ Ref_sec = st.tv_sec; /* take the initial reference point */
-+ Ref_usec = st.tv_usec;
-+ Sleeping_time = ms * 1000;
-+ }
-+
-+ elapsed = (st.tv_sec - Ref_sec) * 1000000 + (st.tv_usec - Ref_usec);
-+ dodelay = Sleeping_time;
-+
-+ if( PLL_filter > 0 && elapsed != 0 ) /* Phase lock loop */
-+ {
-+ dodelay = Expected_time + Sleeping_time - elapsed;
-+
-+ if( dodelay < 0 )
-+ {
-+ dodelay = 0; PLL_filter--;
-+ }
-+ else
-+ if( dodelay > 2*Sleeping_time )
-+ {
-+ dodelay = 2*Sleeping_time; PLL_filter--;
-+ }
-+ else
-+ PLL_filter = 3;
-+
-+ if( elapsed > 40*Sleeping_time && Expected_time > 40*Sleeping_time )
-+ {
-+ elapsed -= 20*Sleeping_time; /* Ref. point shouldn't be far away*/
-+ Expected_time -= 20*Sleeping_time;
-+ Ref_usec += 20*Sleeping_time;
-+ Ref_sec += Ref_usec/1000000; Ref_usec %= 1000000;
-+ }
-+ }
-
--/* if ((ms) > ((1000 / 60) + SyncTime))
-- usleep(ms - SyncTime);
--*/
-- if ((ms + accu) > ((1000 / 30) + SyncTime))
-+ if( PLL_filter <= 0 && elapsed > 40000 ) /* Frequency lock loop */
- {
-- usleep(ms +accu - SyncTime);
-- accu = 0;
-+ /* feedback filter */
-+ x = 0.5 + 0.5 * (float)Expected_time / (float)elapsed;
-+
-+ if( x < 0.966 ) /* Acceleration must be strongly limited */
-+ x = 0.966;
-+
-+ if( x > 2.0 )
-+ x = 2.0;
-+
-+ Sleeping_time = (long)((float)Sleeping_time * x);
-+
-+ if( Sleeping_time < 500 )
-+ Sleeping_time = 500;
-+
-+ if( x > 0.99 && x < 1.01 && Sleeping_time > ms*500 )
-+ PLL_filter = -1 - 4*PLL_filter; /* locked - it's time to try PLL */
-+ else
-+ PLL_filter = 0;
-+
-+ Ref_sec = st.tv_sec;
-+ Ref_usec = st.tv_usec;
-+ Expected_time = 0;
-+ dodelay = Sleeping_time;
- }
-- else if (ms > SyncTime)
-- accu += (ms - SyncTime);
-+
-+ kusleep( dodelay );
-+
-+ Expected_time += ms * 1000;
- }
-
- #if NeedFunctionPrototypes
---- presents.c.orig Thu Nov 20 03:18:42 1997
-+++ presents.c Thu Nov 20 03:21:38 1997
-@@ -287,7 +287,7 @@
- }
- #endif
-
-- SetPresentWait(PRESENT_TEXT1, frame + 800);
-+ SetPresentWait(PRESENT_TEXT1, frame + 200);
- }
-
- #if NeedFunctionPrototypes
-@@ -309,7 +309,7 @@
- RenderShape(display, window, justin, justinM,
- x, y, 285, 44, True);
-
-- SetPresentWait(PRESENT_TEXT2, frame + 300);
-+ SetPresentWait(PRESENT_TEXT2, frame + 100);
- }
-
- #if NeedFunctionPrototypes
-@@ -331,7 +331,7 @@
- RenderShape(display, window, kibell, kibellM,
- x, y, 260, 40, True);
-
-- SetPresentWait(PRESENT_TEXT3, frame + 500);
-+ SetPresentWait(PRESENT_TEXT3, frame + 200);
- }
-
- #if NeedFunctionPrototypes
-@@ -355,7 +355,7 @@
- RenderShape(display, window, presents, presentsM,
- x, y, 410, 44, True);
-
-- SetPresentWait(PRESENT_TEXT_CLEAR, frame + 750);
-+ SetPresentWait(PRESENT_TEXT_CLEAR, frame + 250);
- }
-
- #if NeedFunctionPrototypes
-@@ -375,7 +375,7 @@
-
- FadeAwayArea(display, window, x, y, 410, 44);
-
-- SetPresentWait(PRESENT_LETTERS, frame + 10);
-+ SetPresentWait(PRESENT_LETTERS, frame + 5);
- }
-
- /* The distances for the gap inbetwen blocks */
-@@ -404,7 +404,7 @@
- DrawLetter(display, window, i, x, y);
- x += 10 + dists[i];
-
-- SetPresentWait(PRESENT_LETTERS, frame + 300);
-+ SetPresentWait(PRESENT_LETTERS, frame + 100);
- }
- else
- {
-@@ -416,7 +416,7 @@
- x += dists[3];
- DrawLetter(display, window, 3, x, y);
-
-- SetPresentWait(PRESENT_SHINE, frame + 200);
-+ SetPresentWait(PRESENT_SHINE, frame + 100);
- }
-
- i++;
-@@ -463,7 +463,7 @@
- if (in == 11)
- {
- XCopyArea(display, store, window, gc, 0, 0, 20, 20, x, y);
-- SetPresentWait(PRESENT_SPECIAL_TEXT1, frame + 500);
-+ SetPresentWait(PRESENT_SPECIAL_TEXT1, frame + 100);
- }
- }
- }
-@@ -499,7 +499,7 @@
- len = strlen(wisdom);
- x = ((PLAY_WIDTH + MAIN_WIDTH) / 2) -
- (XTextWidth(dataFont, wisdom, len) / 2);
-- nextFrame = frame + 10;
-+ nextFrame = frame + 5;
- first = False;
- }
-
-@@ -508,11 +508,11 @@
- if (noSound == False) playSoundFile("key", 60);
- DrawText(display, window, x, y, dataFont, red, wisdom, i);
-
-- nextFrame = frame + 30;
-+ nextFrame = frame + 15;
-
- i++;
- if (i > len)
-- SetPresentWait(PRESENT_SPECIAL_TEXT2, frame + 700);
-+ SetPresentWait(PRESENT_SPECIAL_TEXT2, frame + 150);
- }
- }
-
-@@ -542,7 +542,7 @@
- len = strlen(wisdom2);
- x = ((PLAY_WIDTH + MAIN_WIDTH) / 2) -
- (XTextWidth(dataFont, wisdom2, len) / 2);
-- nextFrame = frame + 10;
-+ nextFrame = frame + 5;
- first = False;
- }
-
-@@ -551,11 +551,11 @@
- if (noSound == False) playSoundFile("key", 60);
- DrawText(display, window, x, y, dataFont, red, wisdom2, i);
-
-- nextFrame = frame + 30;
-+ nextFrame = frame + 15;
-
- i++;
- if (i > len)
-- SetPresentWait(PRESENT_SPECIAL_TEXT3, frame + 700);
-+ SetPresentWait(PRESENT_SPECIAL_TEXT3, frame + 150);
- }
- }
-
-@@ -584,7 +584,7 @@
- len = strlen(wisdom3);
- x = ((PLAY_WIDTH + MAIN_WIDTH) / 2) -
- (XTextWidth(dataFont, wisdom3, len) / 2);
-- nextFrame = frame + 10;
-+ nextFrame = frame + 5;
- first = False;
- }
-
-@@ -593,11 +593,11 @@
- if (noSound == False) playSoundFile("key", 60);
- DrawText(display, window, x, y, dataFont, red, wisdom3, i);
-
-- nextFrame = frame + 30;
-+ nextFrame = frame + 15;
-
- i++;
- if (i > len)
-- SetPresentWait(PRESENT_CLEAR, frame + 800);
-+ SetPresentWait(PRESENT_CLEAR, frame + 200);
- }
- }
-
-@@ -642,7 +642,7 @@
- yb -= 10;
-
- if (yt > ((PLAY_HEIGHT + MAIN_HEIGHT) / 2))
-- SetPresentWait(PRESENT_FINISH, frame + 20);
-+ SetPresentWait(PRESENT_FINISH, frame + 10);
-
- nextFrame = frame + 20;
- }
Added: head/games/xboing/files/patch-demo.c
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/games/xboing/files/patch-demo.c Wed Sep 9 18:02:22 2020 (r548113)
@@ -0,0 +1,20 @@
+--- demo.c.orig 1996-11-22 01:28:46 UTC
++++ demo.c
+@@ -107,7 +107,7 @@ static int endFrame = 0;
+ static int startFrame = 0;
+ enum DemoStates DemoState;
+ static int waitingFrame;
+-enum DemoStates waitMode;
++extern enum DemoStates waitMode;
+
+ #if NeedFunctionPrototypes
+ void SetUpDemonstration(Display *display, Window window, Colormap colormap)
+@@ -154,7 +154,7 @@ static void DoBlocks(display, window)
+
+ /* Construct the demo level filename */
+ if ((str = getenv("XBOING_LEVELS_DIR")) != NULL)
+- sprintf(levelPath, "%s/demo.data", str);
++ snprintf(levelPath, sizeof(levelPath),"%s/demo.data", str);
+ else
+ sprintf(levelPath, "%s/demo.data", LEVEL_INSTALL_DIR);
+
Added: head/games/xboing/files/patch-editor.c
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/games/xboing/files/patch-editor.c Wed Sep 9 18:02:22 2020 (r548113)
@@ -0,0 +1,44 @@
+--- editor.c.orig 1996-11-22 01:28:46 UTC
++++ editor.c
+@@ -121,7 +121,7 @@ void DoEditWait();
+ enum EditStates EditState;
+ enum EditStates oldEditState;
+ static int waitingFrame;
+-enum EditStates waitMode;
++extern enum EditStates waitMode;
+ static int oldWidth, oldHeight;
+ static int curBlockType;
+ static int drawAction = ED_NOP;
+@@ -213,7 +213,7 @@ static void DoLoadLevel(display, window)
+
+ /* Construct the Edit level filename */
+ if ((str = getenv("XBOING_LEVELS_DIR")) != NULL)
+- sprintf(levelPath, "%s/editor.data", str);
++ snprintf(levelPath,sizeof(levelPath)-1, "%s/editor.data", str);
+ else
+ sprintf(levelPath, "%s/editor.data", LEVEL_INSTALL_DIR);
+
+@@ -958,8 +958,8 @@ static void LoadALevel(display)
+ if ((num > 0) && (num <= MAX_NUM_LEVELS))
+ {
+ /* Construct the Edit level filename */
+- if ((str2 = getenv("XBOING_LEVELS_DIR")) != NULL)
+- sprintf(levelPath, "%s/level%02ld.data", str2, (u_long) num);
++ if ((str2 = getenv("XBOING_LEVELS_DIR")) != NULL)
++ snprintf(levelPath, sizeof(levelPath)-1,"%s/level%02ld.data", str2, (u_long) num);
+ else
+ sprintf(levelPath, "%s/level%02ld.data",
+ LEVEL_INSTALL_DIR, (u_long) num);
+@@ -1017,9 +1017,9 @@ static void SaveALevel(display)
+ num = atoi(str);
+ if ((num > 0) && (num <= MAX_NUM_LEVELS))
+ {
+- /* Construct the Edit level filename */
+- if ((str2 = getenv("XBOING_LEVELS_DIR")) != NULL)
+- sprintf(levelPath, "%s/level%02ld.data", str2, (u_long) num);
++ /* Construct the Edit level filename */
++ if ((str2 = getenv("XBOING_LEVELS_DIR")) != NULL)
++ snprintf(levelPath, sizeof(levelPath)-1,"%s/level%02ld.data", str2, (u_long) num);
+ else
+ sprintf(levelPath, "%s/level%02ld.data",
+ LEVEL_INSTALL_DIR, (u_long) num);
Added: head/games/xboing/files/patch-file.c
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/games/xboing/files/patch-file.c Wed Sep 9 18:02:22 2020 (r548113)
@@ -0,0 +1,47 @@
+--- file.c.orig 1996-11-22 01:28:46 UTC
++++ file.c
+@@ -139,7 +139,7 @@ void SetupStage(display, window)
+
+ /* Construct the level filename */
+ if ((str = getenv("XBOING_LEVELS_DIR")) != NULL)
+- sprintf(levelPath, "%s/level%02ld.data", str, newLevel);
++ snprintf(levelPath,sizeof(levelPath), "%s/level%02ld.data", str, newLevel);
+ else
+ sprintf(levelPath, "%s/level%02ld.data", LEVEL_INSTALL_DIR, newLevel);
+
+@@ -177,7 +177,7 @@ int LoadSavedGame(display, window)
+ static int bgrnd = 1;
+
+ /* Save the file in home directory - construct path */
+- sprintf(levelPath, "%s/.xboing-saveinfo", GetHomeDir());
++ snprintf(levelPath, sizeof(levelPath)-1, "%s/.xboing-saveinfo", GetHomeDir());
+
+ /* Open the save file info for reading */
+ if ((saveFile = fopen(levelPath, "r+")) == NULL)
+@@ -239,7 +239,7 @@ int LoadSavedGame(display, window)
+ DisplayLevelInfo(display, levelWindow, level);
+
+ /* Load the saved file in home directory - construct path */
+- sprintf(levelPath, "%s/.xboing-savelevel", GetHomeDir());
++ snprintf(levelPath, sizeof(levelPath)-1, "%s/.xboing-savelevel", GetHomeDir());
+
+ /* Read in the saved level data */
+ if (ReadNextLevel(display, window, levelPath, True) == False)
+@@ -283,7 +283,7 @@ int SaveCurrentGame(display, window)
+ saveGame.numBullets = GetNumberBullets();
+
+ /* Save the file in home directory - construct path */
+- sprintf(levelPath, "%s/.xboing-saveinfo", GetHomeDir());
++ snprintf(levelPath, sizeof(levelPath)-1, "%s/.xboing-saveinfo", GetHomeDir());
+
+ /* Open the save file info for writing */
+ if ((saveFile = fopen(levelPath, "w+")) == NULL)
+@@ -309,7 +309,7 @@ int SaveCurrentGame(display, window)
+ WarningMessage("Cannot close save game info file.");
+
+ /* Save the file in home directory - construct path */
+- sprintf(levelPath, "%s/.xboing-savelevel", GetHomeDir());
++ snprintf(levelPath, sizeof(levelPath)-1, "%s/.xboing-savelevel", GetHomeDir());
+
+ if (SaveLevelDataFile(display, levelPath) == True)
+ {
Modified: head/games/xboing/files/patch-highscore.c
==============================================================================
--- head/games/xboing/files/patch-highscore.c Wed Sep 9 17:56:21 2020 (r548112)
+++ head/games/xboing/files/patch-highscore.c Wed Sep 9 18:02:22 2020 (r548113)
@@ -1,5 +1,5 @@
---- highscore.c.orig Thu Nov 20 03:07:35 1997
-+++ highscore.c Thu Nov 20 03:12:23 1997
+--- highscore.c.orig 1996-11-22 01:28:46 UTC
++++ highscore.c
@@ -55,6 +55,7 @@
#include <time.h>
#include <file.h>
@@ -8,7 +8,7 @@
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xos.h>
-@@ -119,7 +120,7 @@
+@@ -119,7 +120,7 @@ static void SetHighScoreWait(enum HighScoreStates newM
static void InitialiseHighScores(void);
static void SortHighScores(void);
static void DeleteScore(int i);
@@ -17,7 +17,16 @@
#else
static int LockUnlock();
static void DeleteScore();
-@@ -844,7 +845,7 @@
+@@ -137,7 +138,7 @@ static int endFrame = 0;
+ enum HighScoreStates HighScoreState;
+ static Pixmap titlePixmap, titlePixmapM;
+ static int waitingFrame;
+-enum HighScoreStates waitMode;
++extern enum HighScoreStates waitMode;
+ static int sparkley = 0;
+ static int sindex = 0;
+ static int si = 0;
+@@ -844,7 +845,7 @@ int CheckAndAddScoreToHighScore(score, level, gameTime
/* Lock the file for me only */
if (type == GLOBAL)
@@ -26,7 +35,7 @@
/* Read in the lastest scores */
if (ReadHighScoreTable(type) == False)
-@@ -875,8 +876,8 @@
+@@ -875,8 +876,8 @@ int CheckAndAddScoreToHighScore(score, level, gameTime
{
/* Don't add as score is smaller */
if (id != -1)
@@ -37,7 +46,7 @@
}
}
} /* for */
-@@ -898,16 +899,17 @@
+@@ -898,16 +899,17 @@ int CheckAndAddScoreToHighScore(score, level, gameTime
/* Unlock the file now thanks */
if (id != -1)
@@ -57,7 +66,25 @@
/* Not even a highscore - loser! */
return False;
-@@ -1185,10 +1187,10 @@
+@@ -1023,7 +1025,7 @@ int ReadHighScoreTable(type)
+ {
+ /* Use the environment variable if it exists */
+ if ((str = getenv("XBOING_SCORE_FILE")) != NULL)
+- strcpy(filename, str);
++ strncpy(filename, str, sizeof(filename)-1);
+ else
+ strcpy(filename, HIGH_SCORE_FILE);
+ }
+@@ -1095,7 +1097,7 @@ int WriteHighScoreTable(type)
+ {
+ /* Use the environment variable if it exists */
+ if ((str = getenv("XBOING_SCORE_FILE")) != NULL)
+- strcpy(filename, str);
++ strncpy(filename, str, sizeof(filename)-1);
+ else
+ strcpy(filename, HIGH_SCORE_FILE);
+ }
+@@ -1185,10 +1187,10 @@ void ResetHighScore(type)
}
#if NeedFunctionPrototypes
@@ -70,7 +97,15 @@
#endif
{
static int inter = -1;
-@@ -1225,6 +1227,9 @@
+@@ -1218,13 +1220,16 @@ static int LockUnlock(cmd)
+
+ /* Use the environment variable if it exists */
+ if ((str = getenv("XBOING_SCORE_FILE")) != NULL)
+- strcpy(filename, str);
++ strncpy(filename, str, sizeof(filename)-1);
+ else
+ strcpy(filename, HIGH_SCORE_FILE);
+
/* Open the highscore file for both read & write */
if (cmd == LOCK_FILE)
inter = open(filename, O_CREAT | O_RDWR, 0666);
Modified: head/games/xboing/files/patch-init.c
==============================================================================
--- head/games/xboing/files/patch-init.c Wed Sep 9 17:56:21 2020 (r548112)
+++ head/games/xboing/files/patch-init.c Wed Sep 9 18:02:22 2020 (r548113)
@@ -1,6 +1,6 @@
---- init.c.orig 1996-11-22 02:28:46.000000000 +0100
-+++ init.c 2014-03-30 18:05:40.000000000 +0200
-@@ -438,7 +438,7 @@
+--- init.c.orig 1996-11-22 01:28:46 UTC
++++ init.c
+@@ -438,7 +438,7 @@ static void HandleDisplayErrors(displayName)
WarningMessage("Your X Window system display variable is not set.");
else
{
@@ -9,7 +9,7 @@
WarningMessage(string);
}
}
-@@ -471,10 +471,10 @@
+@@ -471,10 +471,10 @@ static void PrintUsage()
"Usage: XBoing [-version] [-usage] [-help] [-sync] ",
"[-display <displayName>]\n");
fprintf(stdout, "%s%s\n%s%s\n%s\n",
@@ -22,7 +22,7 @@
" [-nickname <name>] [-noicon]");
/* Exit now */
-@@ -548,10 +548,11 @@
+@@ -548,10 +548,11 @@ static void PrintHelp()
" -scores - Print out the current highscores.\n",
" -keys - Use keys instead of mouse control.\n",
" -sound - Turn audio ON for game.\n",
@@ -35,7 +35,7 @@
" -nickname <name> - Use nickname instead of real name.\n",
" -noicon - Do not create a custom icon.\n",
" -display <display> - Set the display for the game.\n");
-@@ -599,13 +600,13 @@
+@@ -599,13 +600,13 @@ static void InitialiseSettings()
syncOn = False;
debug = False;
grabPointer = False;
@@ -52,7 +52,7 @@
noicon = False;
/* So the audio code will use system default */
-@@ -687,6 +688,13 @@
+@@ -687,6 +688,13 @@ static void ParseCommandLine(argv, argc)
/* Print out the version information and quit */
PrintVersion();
@@ -66,17 +66,17 @@
} else if (!compareArgument(argv[i], "-sound", 5))
{
/* Enable the sound in the game */
-@@ -751,6 +759,13 @@
+@@ -750,6 +758,13 @@ static void ParseCommandLine(argv, argc)
+ useDefaultColourmap = True;
DEBUG("Using default colourmap please.")
-
++
+ } else if (!compareArgument(argv[i], "-no-usedefcmap", 13))
+ {
+ /* Try to use the default colourmap */
+ useDefaultColourmap = False;
+
+ DEBUG("Not using default colourmap.")
-+
+
} else if (!compareArgument(argv[i], "-speed", 5))
{
- /* Set the speed for the game */
Added: head/games/xboing/files/patch-inst.c
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/games/xboing/files/patch-inst.c Wed Sep 9 18:02:22 2020 (r548113)
@@ -0,0 +1,11 @@
+--- inst.c.orig 1996-11-22 01:28:46 UTC
++++ inst.c
+@@ -107,7 +107,7 @@ static int endFrame = 0;
+ static int nextFrame = 0;
+ enum InstructStates InstructState;
+ static int waitingFrame;
+-enum InstructStates waitMode;
++extern enum InstructStates waitMode;
+
+ #if NeedFunctionPrototypes
+ void SetUpInstructions(Display *display, Window window, Colormap colormap)
Added: head/games/xboing/files/patch-intro.c
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/games/xboing/files/patch-intro.c Wed Sep 9 18:02:22 2020 (r548113)
@@ -0,0 +1,11 @@
+--- intro.c.orig 1996-11-22 01:28:46 UTC
++++ intro.c
+@@ -120,7 +120,7 @@ enum IntroStates IntroState;
+ Pixmap bigtitlePixmap, bigtitlePixmapM;
+ Pixmap stars[12], starsM[12];
+ static int waitingFrame;
+-enum IntroStates waitMode;
++extern enum IntroStates waitMode;
+
+ #if NeedFunctionPrototypes
+ void SetUpIntroduction(Display *display, Window window, Colormap colormap)
Added: head/games/xboing/files/patch-keys.c
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/games/xboing/files/patch-keys.c Wed Sep 9 18:02:22 2020 (r548113)
@@ -0,0 +1,11 @@
+--- keys.c.orig 1996-11-22 01:28:46 UTC
++++ keys.c
+@@ -105,7 +105,7 @@ static int endFrame = 0;
+ static int startFrame = 0;
+ enum KeysStates KeysState;
+ static int waitingFrame;
+-enum KeysStates waitMode;
++extern enum KeysStates waitMode;
+ Pixmap mouse, leftarrow, rightarrow;
+ Pixmap mouseM, leftarrowM, rightarrowM;
+
Added: head/games/xboing/files/patch-main.c
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/games/xboing/files/patch-main.c Wed Sep 9 18:02:22 2020 (r548113)
@@ -0,0 +1,11 @@
+--- main.c.orig 1996-11-22 01:28:46 UTC
++++ main.c
+@@ -156,7 +156,7 @@ void SetUserSpeed(delay)
+
+ /* Set an entire game speedup or slowdown speed */
+ temp = (speed / (long) userDelay);
+- userDelay = delay;
++ userDelay = delay/2 + 3;
+ speed = (long) (temp * userDelay);
+ speedLevel = 10 - delay;
+ }
Added: head/games/xboing/files/patch-misc.c
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/games/xboing/files/patch-misc.c Wed Sep 9 18:02:22 2020 (r548113)
@@ -0,0 +1,201 @@
+--- misc.c.orig 1996-11-22 01:28:46 UTC
++++ misc.c
+@@ -89,8 +89,8 @@ void usleep(usec)
+ #ifdef SYSV
+ #ifdef __clipper__
+ struct timeval tv;
+- tv.tv_sec=((usec)/1000);
+- tv.tv_usec=(((usec)%1000)*1000);
++ tv.tv_sec=((usec)/1000000);
++ tv.tv_usec=((usec)%1000000);
+ select(1,NULL,NULL,NULL,&tv);
+ #else
+ poll((struct poll *) 0, (size_t) 0, usec / 1000); /* ms resolution */
+@@ -105,6 +105,68 @@ void usleep(usec)
+ #endif
+
+ #if NeedFunctionPrototypes
++static int kudelay(unsigned long count)
++#else
++static int kudelay(count)
++unsigned long count;
++#endif
++{
++ unsigned int bluff = 1;
++
++ while( count-- != 0 ) /* this can hardly be "optimised out" */
++ bluff = (bluff ^ ((bluff & 1) * 0x6110)) >> 1;
++
++ return( bluff );
++}
++
++#if NeedFunctionPrototypes
++static void kusleep(unsigned long usec)
++#else
++static void kusleep(usec)
++ unsigned long usec;
++#endif
++{
++ static float kuliber_time = 0.0;
++ static float kuliber_count = 0.0;
++ static unsigned long kutimerswap = (1000000 / 15);
++ struct timeval st, et;
++ long gap;
++ unsigned long count;
++
++ if( kuliber_time == 0.0 )
++ {
++ count = 0x1000; /* calibrate delay loop */
++ gettimeofday(&st, NULL);
++
++ while( True )
++ {
++ kudelay( count );
++ count = (count << 1);
++ gettimeofday(&et, NULL);
++ gap = (((et.tv_sec - st.tv_sec) * 1000000) +
++ (et.tv_usec - st.tv_usec) );
++
++ if( gap > 400*1000 )
++ break;
++ }
++
++ kuliber_time = (float)(gap/4);
++ kuliber_count = (float)(((count-1)&~0xFFF)>>2);
++ }
++
++ if( usec > kutimerswap )
++ {
++ kutimerswap = (1000000 / 30);
++ usleep( usec ); /* using usleep() for low resolution only */
++ }
++ else
++ {
++ kutimerswap = (1000000 / 15);
++ kudelay( (unsigned long)(kuliber_count*((float)usec/kuliber_time)) );
++ }
++}
++
++#if NeedFunctionPrototypes
+ void sleepSync(Display *display, unsigned long ms)
+ #else
+ void sleepSync(display, ms)
+@@ -112,27 +174,85 @@ void sleepSync(display, ms)
+ unsigned long ms;
+ #endif
+ {
+- struct timeval st, et;
+- long SyncTime;
+- static unsigned long accu;
++ static long Expected_time = 0;
++ static long Ref_sec = 0;
++ static long Ref_usec = 0;
++ static long Sleeping_time = 0;
++ static int PLL_filter = 0;
++ struct timeval st;
++ long elapsed;
++ long dodelay;
++ float x;
+
+- gettimeofday(&st, NULL);
+ XSync(display, False);
+- gettimeofday(&et, NULL);
+
+- SyncTime = (((et.tv_sec - st.tv_sec) * 1000) +
+- ((et.tv_usec - st.tv_usec) / 1000) );
*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
More information about the svn-ports-all
mailing list