William Kendrick wrote:
I’ve been playing a lot of Twisted Metal: Black lately, and have been
enjoying the cool fireworks/sparkle-like effect for some explosions.
So, I was bored last night (my girlfriend was playing TM ) and decided
to try and whip something up.
It started out as plain 2D at first, but I yanked some cruddy trig. and 3D
code out of my old “ICBM3D” vector-based Xlib game and came up with
something semi-entertaining.
Best of all, I’ve totally commented the code (more so than usual )
so some of you might find it useful, even!
ftp://ftp.sonic.net/pub/users/nbs/unix/x/explosions/
Included is a .tar.gz (of the source, makefile, documentation
and PNG sprite files) as well as a GIF screenshot of the thing running.
It uses a lot of alpha-blending, and the 3D objects are sorted using
a cough bubble-sort, so it might be slow on some older machines.
It requires libSDL and SDL_image.
Enjoy!!!
-bill!
hm… as the screenshots really looked great, of course i wanted to
run the programm, but after having compiled it (“make”), it just
gives me the parachute
—CLI_output::begin—
./explosions
Fatal signal: Segmentation Fault (SDL Parachute Deployed)
—CLI_output::end—
maybe a little strace-output might help…
—strace_output::begin—
[…]
open(“spark7.png”, O_RDONLY) = 5
fstat64(5, {st_mode=S_IFREG|0600, st_size=4176, …}) = 0
old_mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS,
-1, 0) = 0x40081000
_llseek(5, 0, [0], SEEK_CUR) = 0
_llseek(5, 0, [0], SEEK_SET) = 0
_llseek(5, 0, [0], SEEK_SET) = 0
read(5, “\211PNG\r\n\32\n\0\0\0\rIHDR\0\0\0c\0\0\0\23\10\6\0\0\0”…,
4096) = 4096
_llseek(5, 4096, [4096], SEEK_SET) = 0
_llseek(5, 4096, [4096], SEEK_SET) = 0
_llseek(5, 4096, [4096], SEEK_SET) = 0
_llseek(5, 4096, [4096], SEEK_SET) = 0
_llseek(5, 4096, [4096], SEEK_SET) = 0
_llseek(5, 4096, [4096], SEEK_SET) = 0
_llseek(5, 4096, [4096], SEEK_SET) = 0
_llseek(5, 4096, [4096], SEEK_SET) = 0
llseek(5, 4096, [4096], SEEK_SET) = 0
brk(0x808a000) = 0x808a000
read(5, “P\212\312\222\364\243dFt\323\367n\330z\344P\366\3770\376”…,
4096) = 80
close(5) = 0
munmap(0x40081000, 4096) = 0
gettimeofday({997774381, 491733}, NULL) = 0
gettimeofday({997774381, 492069}, NULL) = 0
write(3, “\33\0\2\0\0\0\0\0 \0\2\0\0\0\0\0+\1\1\0”, 20) = 20
read(3, “\34\0M\0\3\0\300\0010\1\0\0\243\321\374O\0\0\0\0\0\0\0”…, 32)
= 32
read(3, 0xbffff488, 32) = -1 EAGAIN (Resource
temporarily unavailable)
select(4, [3], NULL, NULL, NULL) = 1 (in [3])
read(3, “\1\1P\0\0\0\0\0\n\0@\1\0\0\0\0\0\0\0\0\0\0\0\0\370\1\217”…,
32) = 32
write(3, “\221\3\n\0\r\0\300\1\16\0\300\1\240\0\240\0\0\0\0\0\240”…,
44) = 44
read(3, 0xbffff498, 32) = -1 EAGAIN (Resource
temporarily unavailable)
select(4, [3], NULL, NULL, NULL) = 1 (in [3])
read(3, “\1\1R\0\0\0\0\0\n\0@\1\0\0\0\0\0\0\0\0\0\0\0\0\370\1\217”…,
32) = 32
write(3, “\221\3\n\0\r\0\300\1\16\0\300\1\240\0\240\0\0\0\0\0\240”…,
44) = 44
read(3, 0xbffff498, 32) = -1 EAGAIN (Resource
temporarily unavailable)
select(4, [3], NULL, NULL, NULL) = 1 (in [3])
read(3, “\1\1T\0\0\0\0\0\n\0@\1\0\0\0\0\0\0\0\0\0\0\0\0\370\1\217”…,
32) = 32
select(4, [3], NULL, NULL, {0, 0}) = 0 (Timeout)
select(4, [3], NULL, NULL, {0, 0}) = 0 (Timeout)
— SIGSEGV (Segmentation fault) —
rt_sigaction(SIGSEGV, {SIG_DFL}, {0x4009a620, [SEGV],
SA_RESTART|0x4000000}, 8)
= 0
write(2, "Fatal signal: “, 14Fatal signal: ) = 14
write(2, “Segmentation Fault”, 18Segmentation Fault) = 18
write(2, " (SDL Parachute Deployed)\n”, 26 (SDL Parachute Deployed)
) = 26
write(3, "\3\2\0\v\0\300\1+\0\1\0", 12) = 12
read(3, 0xbffff0e8, 32) = -1 EAGAIN (Resource
temporarily unavailable)
select(4, [3], NULL, NULL, NULL) = 1 (in [3])
read(3, “\1\1V\0\0\0\0\0\n\0@\1\0\0\0\0\0\0\0\0\0\0\0\0\370\1\217”…,
32) = 32
write(4, “+\3\1\0”, 4) = 4
read(4, 0xbffff118, 32) = -1 EAGAIN (Resource
temporarily unavailable)
select(5, [4], NULL, NULL, NULL) = 1 (in [4])
read(4, “\1\1\16\0\0\0\0\0\n\0@\1\0\0\0\0\1\0\0\0\1\0\0\0X\223\213”…,
32) = 32write(3, “\221\2\2\0\17\0\300\1+\0\1\0”, 12) = 12
read(3, 0xbffff0e8, 32) = -1 EAGAIN (Resource
temporarily unavailable)
select(4, [3], NULL, NULL, NULL) = 1 (in [3])
read(3, “\1\1X\0\0\0\0\0\n\0@\1\0\0\0\0\0\0\0\0\0\0\0\0\370\1\217”…,
32) = 32
shmdt(0x4036a000) = 0
write(3, “\n\2\2\0\3\0\300\1\4\0\2\0\r\0\300\1<\0\2\0\16\0\300\1”…,
44) = 44
read(3, 0xbffff0e8, 32) = -1 EAGAIN (Resource
temporarily unavailable)
select(4, [3], NULL, NULL, NULL) = 1 (in [3])
read(3, “\22\0Y\0\3\0\300\1\3\0\300\1\0p\204\10\3\0\300\1\366\377"..., 32) = 32read(3, "\1\1^\0\0\0\0\0\n\0@\1\0\0\0\0\0\0\0\0\0\0\0\0\370\1\217"..., 32) = 32 write(4, "<\3\2\0\0\0\340\2+\0\1\0", 12) = 12 read(4, 0xbffff0fc, 32) = -1 EAGAIN (Resource temporarily unavailable) select(5, [4], NULL, NULL, NULL) = 1 (in [4]) read(4, "\1\1\20\0\0\0\0\0\n\0@\1\0\0\0\0\0\0\0\0\1\0\0\0X\223\213"..., 32) = 32shutdown(4, 2 /* send and receive */) = 0 close(4) = 0 write(3, "<\2\2\0\0\0\300\1+\0\1\0", 12) = 12 read(3, "\34\0^\0\3\0\300\1j\0\0\0002\322\374O\0\0\0\0\3\0\300\1"..., 32) = 32 read(3, "\34\366^\0\3\0\300\0013\1\0\0002\322\374O\1\0\0\0002\322"..., 32) = 32 read(3, "\226\20^\0\3\0\300\1\3\0\300\1>\317K at 0\5n\1\240\0\240\0"..., 32) = 32 read(3, "\25\0^\0\3\0\300\1\3\0\300\0017\0\0\0,\5\\\1\0\365\377"..., 32) = 32 read(3, 0xbffff0fc, 32) = -1 EAGAIN (Resource temporarily unavailable) select(4, [3], NULL, NULL, NULL) = 1 (in [3]) read(3, "\1\1
\0\0\0\0\0\n\0@\1\0\0\0\0\0\0\0\0\0\0\0\0\370\1\217”…,
32) = 32
shutdown(3, 2 /* send and receive */) = 0
close(3) = 0
rt_sigaction(SIGSEGV, {SIG_DFL}, {SIG_DFL}, 8) = 0
rt_sigaction(SIGSEGV, {SIG_DFL}, {SIG_DFL}, 8) = 0
rt_sigaction(SIGBUS, {SIG_DFL}, {0x4009a620, [BUS],
SA_RESTART|0x4000000}, 8) =
0
rt_sigaction(SIGFPE, {SIG_DFL}, {0x4009a620, [FPE],
SA_RESTART|0x4000000}, 8) =
0
rt_sigaction(SIGQUIT, {SIG_DFL}, {0x4009a620, [QUIT],
SA_RESTART|0x4000000}, 8)
= 0
rt_sigaction(SIGPIPE, {SIG_DFL}, {0x4009a620, [PIPE],
SA_RESTART|0x4000000}, 8)
= 0
_exit(-11) = ?
—strace_output::end—
hm… to me both messages (CLI and strace) are not very meaningful,
or rather, they don’t give me a clue on where to start “debugging”.
any ideas ?
ah…
-
Red Hat Linux release 7.1 (Seawolf),
Kernel 2.4.5 on an i586
-
XFree86 Version 4.0.3 / X Window System
-
SDL-1.2.1-3, SDL-devel-1.2.1-3,
SDL_mixer-1.2.0-1, SDL_mixer-devel-1.2.0-1,
SDL_image-1.2.0-1, SDL_image-devel-1.2.0-1
-
nvidia_drv.o (NVIDIA_GLX 1.0)
-
something i forgot?
TIA–
br,
#nos