Date: Mon, 11 Dec 2000 16:31:12 +0200 From: Peter Pentchev <roam@orbitel.bg> To: hackers@FreeBSD.org Subject: Re: eye-candy hack - warp_saver changing direction :) Message-ID: <20001211163112.B606@ringworld.oblivion.bg> In-Reply-To: <20001211161847.A606@ringworld.oblivion.bg>; from roam@orbitel.bg on Mon, Dec 11, 2000 at 04:18:47PM %2B0200 References: <20001211161847.A606@ringworld.oblivion.bg>
next in thread | previous in thread | raw e-mail | index | archive | help
OK, OK, I *promise* I'll think twice before posting next time :)
Here's a revised patch - a kern.warp_period <= 0 signifies no direction
change, for those who prefer the old behavior.
G'luck,
Peter
--
This sentence no verb.
Patch against -current:
Index: src/sys/modules/syscons/warp/warp_saver.c
===================================================================
RCS file: /home/ncvs/src/sys/modules/syscons/warp/warp_saver.c,v
retrieving revision 1.9
diff -u -r1.9 warp_saver.c
--- src/sys/modules/syscons/warp/warp_saver.c 2000/06/25 09:39:11 1.9
+++ src/sys/modules/syscons/warp/warp_saver.c 2000/12/11 14:00:29
@@ -35,6 +35,7 @@
#include <sys/syslog.h>
#include <sys/consio.h>
#include <sys/fbio.h>
+#include <sys/sysctl.h>
#include <dev/fb/fbreg.h>
#include <dev/fb/splashreg.h>
@@ -58,19 +59,35 @@
/* the rest is zero-filled by the compiler */
};
+static int warp_dir = 1, warp_period = 10000;
+SYSCTL_INT(_kern, OID_AUTO, warp_dir, CTLFLAG_RW, &warp_dir, 0, "")
+SYSCTL_INT(_kern, OID_AUTO, warp_period, CTLFLAG_RW, &warp_period, 0, "")
+
static void
-warp_update(void)
+warp_update(int *pdir, int period)
{
int i, j, k, n;
+ static int cur_state = 0;
for (i = 1, k = 0, n = SPP*8; i < 5; i++, n /= 2)
for (j = 0; j < n; j++, k++) {
vid[star[k]] = 0;
- star[k] += i;
- if (star[k] > SCRW*SCRH)
- star[k] -= SCRW*SCRH;
+ if (*pdir) {
+ star[k] += i;
+ if (star[k] > SCRW*SCRH)
+ star[k] -= SCRW*SCRH;
+ } else {
+ star[k] -= i;
+ if (star[k] < 0)
+ star[k] += SCRW*SCRH;
+ }
vid[star[k]] = i;
}
+
+ if ((period > 0) && (++cur_state >= period)) {
+ *pdir = !*pdir;
+ cur_state = 0;
+ }
}
static int
@@ -94,7 +111,7 @@
}
/* update display */
- warp_update();
+ warp_update(&warp_dir, warp_period);
} else {
blanked = 0;
...........................
.. and against 4.2-STABLE..
Index: src/sys/modules/syscons/warp/warp_saver.c
===================================================================
RCS file: /home/ncvs/src/sys/modules/syscons/warp/warp_saver.c,v
retrieving revision 1.7.2.1
diff -u -r1.7.2.1 warp_saver.c
--- src/sys/modules/syscons/warp/warp_saver.c 2000/05/10 16:26:47 1.7.2.1
+++ src/sys/modules/syscons/warp/warp_saver.c 2000/12/11 13:58:14
@@ -36,6 +36,7 @@
#include <sys/consio.h>
#include <sys/fbio.h>
#include <sys/random.h>
+#include <sys/sysctl.h>
#include <dev/fb/fbreg.h>
#include <dev/fb/splashreg.h>
@@ -59,19 +60,35 @@
/* the rest is zero-filled by the compiler */
};
+static int warp_dir = 1, warp_period = 10000;
+SYSCTL_INT(_kern, OID_AUTO, warp_dir, CTLFLAG_RW, &warp_dir, 0, "")
+SYSCTL_INT(_kern, OID_AUTO, warp_period, CTLFLAG_RW, &warp_period, 0, "")
+
static void
-warp_update(void)
+warp_update(int *pdir, int period)
{
int i, j, k, n;
+ static int cur_state = 0;
for (i = 1, k = 0, n = SPP*8; i < 5; i++, n /= 2)
for (j = 0; j < n; j++, k++) {
vid[star[k]] = 0;
- star[k] += i;
- if (star[k] > SCRW*SCRH)
- star[k] -= SCRW*SCRH;
+ if (*pdir) {
+ star[k] += i;
+ if (star[k] > SCRW*SCRH)
+ star[k] -= SCRW*SCRH;
+ } else {
+ star[k] -= i;
+ if (star[k] < 0)
+ star[k] += SCRW*SCRH;
+ }
vid[star[k]] = i;
}
+
+ if ((period > 0) && (++cur_state >= period)) {
+ *pdir = !*pdir;
+ cur_state = 0;
+ }
}
static int
@@ -95,7 +112,7 @@
}
/* update display */
- warp_update();
+ warp_update(&warp_dir, warp_period);
} else {
blanked = 0;
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20001211163112.B606>
