├── debian ├── dirs ├── pinball.docs ├── pinball.manpages ├── source │ └── format ├── pinball-data.install ├── pinball-dev.manpages ├── tests │ ├── control │ └── smoke ├── watch ├── gbp.conf ├── pinball.install ├── changelog ├── pinball-dev.install ├── pinball.postrm ├── upstream │ └── metadata ├── clean ├── pinball.postinst ├── pinball-config.6 └── rules ├── test ├── module.txt ├── fire.png ├── tex.jpg ├── token.txt ├── explode.png ├── font_12.pcx ├── font_16.pcx ├── script.txt ├── collision.cpp ├── explode2.png ├── moduletest.cpp ├── unittest.cpp ├── joy.cpp ├── Makefile.am ├── big.cpp ├── key.cpp ├── sound.cpp ├── simple.cpp ├── thread.cpp ├── camera.cpp ├── billboard.cpp ├── font.cpp ├── alpha.cpp ├── anim.cpp ├── trans.cpp ├── light.cpp ├── ship.emi ├── tmp.emi ├── texture.cpp ├── signal.cpp └── misc.cpp ├── NEWS ├── snap └── hooks │ └── configure ├── data ├── menu.mid ├── font_34.png ├── font_35.pcx ├── splash.png ├── tux │ ├── up.wav │ ├── bump.wav │ ├── face.png │ ├── face2.png │ ├── flip.wav │ ├── floor2.png │ ├── floor3.png │ ├── game.mid │ ├── game.ogg │ ├── intro.mid │ ├── intro.ogg │ ├── lock.wav │ ├── loop.wav │ ├── nudge.wav │ ├── shoot.wav │ ├── tiles.png │ ├── bumphard.wav │ ├── bumpsoft.wav │ ├── face.png.pcx │ ├── gameover.wav │ ├── locklock.wav │ ├── opentux.wav │ ├── floor2.png.pcx │ ├── multiball.mid │ ├── multiball.ogg │ ├── tiles.png.pcx │ └── Makefile.am ├── splash.png.pcx ├── professor │ ├── bump.wav │ ├── flip.wav │ ├── floor.png │ ├── nudge.wav │ ├── introp.ogg │ ├── bumphard.wav │ ├── bumpsoft.wav │ ├── floor.png.pcx │ ├── gameover.wav │ ├── professor.mid │ ├── professor.ogg │ ├── professor.png │ └── Makefile.am ├── Makefile.am └── pinball.xpm ├── .github ├── FUNDING.yml └── workflows │ └── fediverse-action.yml ├── .travis.yml ├── base ├── CollisionVisitor.cpp ├── Camera.cpp ├── Behavior.cpp ├── SoundVisitor.h ├── BehaviorVisitor.h ├── TransformVisitor.h ├── RenderVisitor.cpp ├── SoundVisitor.cpp ├── OpenGLVisitor.h ├── Camera.h ├── PointLightVisitor.h ├── Light.cpp ├── OctTree.h ├── AmbientLightVisitor.h ├── Sound.h ├── Profiler.h ├── AlignVisitor.h ├── BillBoard.cpp ├── SignalSender.h ├── RenderVisitor.h ├── BehaviorVisitor.cpp ├── Makefile.am ├── Sound.cpp ├── BillBoard.h ├── AllegroVisitor.h ├── EmFont.h ├── Node.h ├── Light.h ├── Visitor.h ├── StateMachine.h ├── CollisionBounds.h └── SoundUtil.h ├── extra ├── files │ └── screenshot.png ├── profile │ ├── pinball │ │ └── etc │ │ │ ├── pinball │ │ │ ├── xinit.env.sh │ │ │ ├── pinball.service │ │ │ ├── xinit.service │ │ │ ├── pinball │ │ │ ├── weston.service │ │ │ ├── pinball.env.sh │ │ │ ├── configure.sh │ │ │ └── install.sh │ │ │ └── init.d │ │ │ └── pinball │ └── pincab │ │ └── etc │ │ └── pinball │ │ ├── pinball │ │ ├── weston.ini │ │ └── pinball.env.sh ├── debos │ ├── machine │ │ ├── generic │ │ │ ├── image.yaml │ │ │ ├── pinball-i386.yaml │ │ │ ├── pinball-amd64.yaml │ │ │ └── actions.yaml │ │ ├── rpi_4 │ │ │ ├── image.yaml │ │ │ ├── actions.yaml │ │ │ └── pinball-rpi_4.yaml │ │ ├── rpi_3_32b │ │ │ ├── image.yaml │ │ │ ├── actions.yaml │ │ │ └── pinball-rpi_3_32b.yaml │ │ ├── rpi_3_64b │ │ │ ├── image.yaml │ │ │ ├── actions.yaml │ │ │ └── pinball-rpi_3_64b.yaml │ │ └── rpi_2 │ │ │ ├── pinball-rpi_2.yaml │ │ │ └── image.yaml │ └── pinball.yaml ├── fink │ └── pinball.info └── Makefile ├── bootstrap ├── docs ├── contact.md ├── Home.md ├── screenshots.md ├── credits.md ├── bugs.md ├── download.md ├── editor.md ├── index.md ├── Makefile ├── news.md └── faq.md ├── docker-compose.yml ├── .whitesource ├── Makefile.am ├── pinball.desktop ├── addon ├── BigSphere.h ├── Makefile.am ├── Sphere.h ├── Cube.h ├── Cone.h ├── Cylinder.h ├── KeyBehavior.h ├── KeyRotBehavior.h ├── TexAnimation.h ├── ColorBehavior.h ├── KeyRotBehavior.cpp ├── KeyBehavior.cpp ├── Grid.h ├── ColorBehavior.cpp ├── Cone.cpp ├── Grid.cpp ├── Cylinder.cpp └── TexAnimation.cpp ├── AUTHORS ├── ChangeLog ├── CONTRIBUTING.md ├── pinball.appdata.xml ├── src ├── BallGroup.h ├── BumperBehavior.h ├── FakeModuleBehavior.h ├── ArmBehavior.h ├── PlungerBehavior.h ├── LoaderModule.h ├── BounceBehavior.h ├── BumperBehavior.cpp ├── Makefile.am ├── EyeBehavior.h ├── Score.h ├── Script.h ├── Script.cpp └── Obj3dsUtil.h ├── BUILD.md ├── pinball.dsw ├── Dockerfile ├── pinball-config.in ├── FAQ.md ├── .gitignore ├── .dockerignore └── pinball.spec /debian/dirs: -------------------------------------------------------------------------------- 1 | /usr/games 2 | -------------------------------------------------------------------------------- /debian/pinball.docs: -------------------------------------------------------------------------------- 1 | README 2 | -------------------------------------------------------------------------------- /debian/pinball.manpages: -------------------------------------------------------------------------------- 1 | pinball.6 2 | -------------------------------------------------------------------------------- /debian/source/format: -------------------------------------------------------------------------------- 1 | 3.0 (quilt) 2 | -------------------------------------------------------------------------------- /test/module.txt: -------------------------------------------------------------------------------- 1 | { 2 | libModuleTest.la 3 | } 4 | -------------------------------------------------------------------------------- /debian/pinball-data.install: -------------------------------------------------------------------------------- 1 | usr/share/games/pinball 2 | -------------------------------------------------------------------------------- /debian/pinball-dev.manpages: -------------------------------------------------------------------------------- 1 | debian/pinball-config.6 2 | -------------------------------------------------------------------------------- /NEWS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RaymiiOrg/pinball/master/NEWS -------------------------------------------------------------------------------- /snap/hooks/configure: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | snapctl restart $SNAP_NAME 3 | -------------------------------------------------------------------------------- /data/menu.mid: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RaymiiOrg/pinball/master/data/menu.mid -------------------------------------------------------------------------------- /debian/tests/control: -------------------------------------------------------------------------------- 1 | Tests: smoke 2 | Depends: @ 3 | Restrictions: allow-stderr 4 | -------------------------------------------------------------------------------- /test/fire.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RaymiiOrg/pinball/master/test/fire.png -------------------------------------------------------------------------------- /test/tex.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RaymiiOrg/pinball/master/test/tex.jpg -------------------------------------------------------------------------------- /test/token.txt: -------------------------------------------------------------------------------- 1 | a b 2 | aa bb cc 3 | 4 | aaaa bbbb 5 | 12 6 | aaaaaa bbbbbb 7 | -------------------------------------------------------------------------------- /data/font_34.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RaymiiOrg/pinball/master/data/font_34.png -------------------------------------------------------------------------------- /data/font_35.pcx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RaymiiOrg/pinball/master/data/font_35.pcx -------------------------------------------------------------------------------- /data/splash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RaymiiOrg/pinball/master/data/splash.png -------------------------------------------------------------------------------- /data/tux/up.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RaymiiOrg/pinball/master/data/tux/up.wav -------------------------------------------------------------------------------- /debian/watch: -------------------------------------------------------------------------------- 1 | version=4 2 | https://sf.net/pinball/pinball-([\d+\.]+|\d+)\.tar\.gz 3 | -------------------------------------------------------------------------------- /test/explode.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RaymiiOrg/pinball/master/test/explode.png -------------------------------------------------------------------------------- /test/font_12.pcx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RaymiiOrg/pinball/master/test/font_12.pcx -------------------------------------------------------------------------------- /test/font_16.pcx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RaymiiOrg/pinball/master/test/font_16.pcx -------------------------------------------------------------------------------- /test/script.txt: -------------------------------------------------------------------------------- 1 | { 2 | onsignal 1 11 setvar 101 1 3 | onsignal 1 22 setvar 101 2 4 | } -------------------------------------------------------------------------------- /data/splash.png.pcx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RaymiiOrg/pinball/master/data/splash.png.pcx -------------------------------------------------------------------------------- /data/tux/bump.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RaymiiOrg/pinball/master/data/tux/bump.wav -------------------------------------------------------------------------------- /data/tux/face.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RaymiiOrg/pinball/master/data/tux/face.png -------------------------------------------------------------------------------- /data/tux/face2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RaymiiOrg/pinball/master/data/tux/face2.png -------------------------------------------------------------------------------- /data/tux/flip.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RaymiiOrg/pinball/master/data/tux/flip.wav -------------------------------------------------------------------------------- /data/tux/floor2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RaymiiOrg/pinball/master/data/tux/floor2.png -------------------------------------------------------------------------------- /data/tux/floor3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RaymiiOrg/pinball/master/data/tux/floor3.png -------------------------------------------------------------------------------- /data/tux/game.mid: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RaymiiOrg/pinball/master/data/tux/game.mid -------------------------------------------------------------------------------- /data/tux/game.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RaymiiOrg/pinball/master/data/tux/game.ogg -------------------------------------------------------------------------------- /data/tux/intro.mid: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RaymiiOrg/pinball/master/data/tux/intro.mid -------------------------------------------------------------------------------- /data/tux/intro.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RaymiiOrg/pinball/master/data/tux/intro.ogg -------------------------------------------------------------------------------- /data/tux/lock.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RaymiiOrg/pinball/master/data/tux/lock.wav -------------------------------------------------------------------------------- /data/tux/loop.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RaymiiOrg/pinball/master/data/tux/loop.wav -------------------------------------------------------------------------------- /data/tux/nudge.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RaymiiOrg/pinball/master/data/tux/nudge.wav -------------------------------------------------------------------------------- /data/tux/shoot.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RaymiiOrg/pinball/master/data/tux/shoot.wav -------------------------------------------------------------------------------- /data/tux/tiles.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RaymiiOrg/pinball/master/data/tux/tiles.png -------------------------------------------------------------------------------- /test/collision.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RaymiiOrg/pinball/master/test/collision.cpp -------------------------------------------------------------------------------- /test/explode2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RaymiiOrg/pinball/master/test/explode2.png -------------------------------------------------------------------------------- /data/tux/bumphard.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RaymiiOrg/pinball/master/data/tux/bumphard.wav -------------------------------------------------------------------------------- /data/tux/bumpsoft.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RaymiiOrg/pinball/master/data/tux/bumpsoft.wav -------------------------------------------------------------------------------- /data/tux/face.png.pcx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RaymiiOrg/pinball/master/data/tux/face.png.pcx -------------------------------------------------------------------------------- /data/tux/gameover.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RaymiiOrg/pinball/master/data/tux/gameover.wav -------------------------------------------------------------------------------- /data/tux/locklock.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RaymiiOrg/pinball/master/data/tux/locklock.wav -------------------------------------------------------------------------------- /data/tux/opentux.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RaymiiOrg/pinball/master/data/tux/opentux.wav -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | github: [rzr] 2 | custom: ["https://www.paypal.me/rzrfreefr", www.rzr.online.fr] -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | dist: bionic 2 | sudo: required 3 | services: docker 4 | script: 5 | - docker build . 6 | -------------------------------------------------------------------------------- /data/professor/bump.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RaymiiOrg/pinball/master/data/professor/bump.wav -------------------------------------------------------------------------------- /data/professor/flip.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RaymiiOrg/pinball/master/data/professor/flip.wav -------------------------------------------------------------------------------- /data/professor/floor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RaymiiOrg/pinball/master/data/professor/floor.png -------------------------------------------------------------------------------- /data/professor/nudge.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RaymiiOrg/pinball/master/data/professor/nudge.wav -------------------------------------------------------------------------------- /data/tux/floor2.png.pcx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RaymiiOrg/pinball/master/data/tux/floor2.png.pcx -------------------------------------------------------------------------------- /data/tux/multiball.mid: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RaymiiOrg/pinball/master/data/tux/multiball.mid -------------------------------------------------------------------------------- /data/tux/multiball.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RaymiiOrg/pinball/master/data/tux/multiball.ogg -------------------------------------------------------------------------------- /data/tux/tiles.png.pcx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RaymiiOrg/pinball/master/data/tux/tiles.png.pcx -------------------------------------------------------------------------------- /base/CollisionVisitor.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RaymiiOrg/pinball/master/base/CollisionVisitor.cpp -------------------------------------------------------------------------------- /data/professor/introp.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RaymiiOrg/pinball/master/data/professor/introp.ogg -------------------------------------------------------------------------------- /extra/files/screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RaymiiOrg/pinball/master/extra/files/screenshot.png -------------------------------------------------------------------------------- /data/professor/bumphard.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RaymiiOrg/pinball/master/data/professor/bumphard.wav -------------------------------------------------------------------------------- /data/professor/bumpsoft.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RaymiiOrg/pinball/master/data/professor/bumpsoft.wav -------------------------------------------------------------------------------- /data/professor/floor.png.pcx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RaymiiOrg/pinball/master/data/professor/floor.png.pcx -------------------------------------------------------------------------------- /data/professor/gameover.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RaymiiOrg/pinball/master/data/professor/gameover.wav -------------------------------------------------------------------------------- /data/professor/professor.mid: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RaymiiOrg/pinball/master/data/professor/professor.mid -------------------------------------------------------------------------------- /data/professor/professor.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RaymiiOrg/pinball/master/data/professor/professor.ogg -------------------------------------------------------------------------------- /data/professor/professor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RaymiiOrg/pinball/master/data/professor/professor.png -------------------------------------------------------------------------------- /bootstrap: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | # SPDX-License-Identifier: GPL-2 3 | set -e 4 | set -x 5 | 6 | ./helper.mk bootstrap 7 | -------------------------------------------------------------------------------- /debian/gbp.conf: -------------------------------------------------------------------------------- 1 | [DEFAULT] 2 | debian-branch=debian/master 3 | upstream-branch=master 4 | filter=*/.git 5 | upstream-tag=%(version)s 6 | -------------------------------------------------------------------------------- /extra/profile/pinball/etc/pinball/xinit.env.sh: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-2.0+ 2 | 3 | XINITRC=/etc/pinball/pinball-session.sh 4 | -------------------------------------------------------------------------------- /debian/tests/smoke: -------------------------------------------------------------------------------- 1 | #!/bin/sh -e 2 | 3 | export HOME=${AUTOPKGTEST_TMP:-${TMPDIR:-/tmp}} 4 | pinball -dir | grep '/usr/share/games/pinball' 5 | -------------------------------------------------------------------------------- /debian/pinball.install: -------------------------------------------------------------------------------- 1 | usr/games/pinball 2 | usr/lib/*/pinball/*.la 3 | usr/lib/*/pinball/*.so.* 4 | usr/share/applications/pinball.desktop 5 | usr/share/pixmaps/pinball.xpm 6 | -------------------------------------------------------------------------------- /debian/changelog: -------------------------------------------------------------------------------- 1 | pinball (0.0.0-0) unstable; urgency=medium 2 | 3 | * wip: https://purl.org/rzr 4 | 5 | -- Philippe Coval Fri, 31 Jul 2020 16:23:26 +0200 6 | -------------------------------------------------------------------------------- /debian/pinball-dev.install: -------------------------------------------------------------------------------- 1 | usr/include 2 | usr/games/pinball-config 3 | usr/lib/*/pinball/libemilia_addon.a 4 | usr/lib/*/pinball/libemilia_base.a 5 | usr/lib/*/pinball/libemilia_pin.a 6 | -------------------------------------------------------------------------------- /debian/pinball.postrm: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | set -e 4 | 5 | if [ "$1" = "purge" ] ; then 6 | 7 | if [ -d /var/games/pinball ]; then 8 | rm -rf /var/games/pinball 9 | fi 10 | 11 | fi 12 | 13 | #DEBHELPER# 14 | -------------------------------------------------------------------------------- /docs/contact.md: -------------------------------------------------------------------------------- 1 | # Contact # 2 | 3 | Comments, bug reports and fan mail can be mailed to henqvist at users.sourceforge.net 4 | please use the word 'pinball' somewhere in the subject 5 | otherwise it may go in the thrash as spam. 6 | -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # SPDX-License-Identifier: GPL-2.0 3 | 4 | version: "2" 5 | 6 | services: 7 | default: 8 | build: . 9 | environment: 10 | - DISPLAY=unix:0 11 | volumes: 12 | - /tmp/.X11-unix:/tmp/.X11-unix 13 | -------------------------------------------------------------------------------- /extra/profile/pinball/etc/pinball/pinball.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | After=weston.service 3 | Requires=display-manager.service 4 | 5 | [Service] 6 | Type=single 7 | ExecStart=/etc/pinball/pinball-session.sh 8 | Restart=always 9 | 10 | [Install] 11 | WantedBy=graphical.target 12 | -------------------------------------------------------------------------------- /.whitesource: -------------------------------------------------------------------------------- 1 | { 2 | "scanSettings": { 3 | "configMode": "AUTO", 4 | "configExternalURL": "" 5 | }, 6 | "checkRunSettings": { 7 | "vulnerableCheckRunConclusionLevel": "failure" 8 | }, 9 | "issueSettings": { 10 | "minSeverityLevel": "LOW" 11 | } 12 | } -------------------------------------------------------------------------------- /data/Makefile.am: -------------------------------------------------------------------------------- 1 | AUTOMAKE_OPTIONS = gnu 2 | 3 | SUBDIRS = tux professor 4 | 5 | pindatadir = $(datadir)/pinball 6 | 7 | pindata_DATA = \ 8 | font_34.png \ 9 | font_35.pcx \ 10 | pinball.xpm \ 11 | splash.png \ 12 | splash.png.pcx 13 | 14 | EXTRA_DIST = $(pindata_DATA) 15 | -------------------------------------------------------------------------------- /docs/Home.md: -------------------------------------------------------------------------------- 1 | - [bugs.md](bugs.md) 2 | - [contact.md](contact.md) 3 | - [credits.md](credits.md) 4 | - [download.md](download.md) 5 | - [editor.md](editor.md) 6 | - [faq.md](faq.md) 7 | - [index.md](index.md) 8 | - [news.md](news.md) 9 | - [screenshots.md](screenshots.md) 10 | -------------------------------------------------------------------------------- /docs/screenshots.md: -------------------------------------------------------------------------------- 1 | - http://pinball.sourceforge.net/ss20021024_1.jpg 2 | - http://pinball.sourceforge.net/ss20021024_2.jpg 3 | - http://pinball.sourceforge.net/ss20021024_3.jpg 4 | - http://pinball.sourceforge.net/ss20021024_3.jpg 5 | - http://pinball.sourceforge.net/editor20030616.jpg 6 | -------------------------------------------------------------------------------- /extra/profile/pinball/etc/pinball/xinit.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | RequiresMountsFor=/run 3 | 4 | [Service] 5 | User=root 6 | EnvironmentFile=-/etc/pinball/pinball.env.sh 7 | ExecStart=/usr/bin/xinit ${XINIT_ARGS} 8 | 9 | # TODO 10 | [Install] 11 | Alias=display-manager.service 12 | WantedBy=graphical.target 13 | -------------------------------------------------------------------------------- /debian/upstream/metadata: -------------------------------------------------------------------------------- 1 | Bug-Database: https://sourceforge.net/p/pinball/bugs/ 2 | Bug-Submit: https://sourceforge.net/p/pinball/bugs/new/ 3 | Documentation: https://sourceforge.net/p/pinball/wiki/Home/ 4 | Repository-Browse: https://sourceforge.net/p/pinball/code/ 5 | Repository: https://git.code.sf.net/p/pinball/code.git 6 | -------------------------------------------------------------------------------- /Makefile.am: -------------------------------------------------------------------------------- 1 | AUTOMAKE_OPTIONS = gnu 2 | 3 | SUBDIRS = libltdl addon base data src test 4 | 5 | EXTRA_DIST = bootstrap pinball.spec clean pinball.desktop 6 | 7 | pinincludedir = $(includedir)/pinball 8 | 9 | pininclude_HEADERS = pinconfig.h 10 | 11 | bin_SCRIPTS = pinball-config 12 | 13 | ACLOCAL_AMFLAGS = -I libltdl/m4 14 | -------------------------------------------------------------------------------- /pinball.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Categories=Game;Simulation;ArcadeGame; 3 | Name=Emilia Pinball 4 | Comment=3D pinball game 5 | Exec=pinball 6 | Icon=pinball 7 | Terminal=false 8 | Type=Application 9 | Comment[fr]=Jeu de flipper 3D 10 | Comment[ca]=Pinball 3D 11 | Comment[es]=Pinball 3D 12 | Keywords=Game;Arcade;Pinball;ArcadeGame 13 | -------------------------------------------------------------------------------- /docs/credits.md: -------------------------------------------------------------------------------- 1 | # CREDITS # 2 | 3 | ## CREW ## 4 | 5 | - Lead developer: Henrik Enqvist. 6 | - Porting, coding: Philippe Coval. 7 | - Coding: Pedro Ferreira. 8 | 9 | ## SPECIAL THANKS ## 10 | 11 | - Bastian Salmela for the splash screen. 12 | - Thomas Thierry for maintaining a FreeBSD port. 13 | - And everybody else I forgot to mention. 14 | -------------------------------------------------------------------------------- /extra/debos/machine/generic/image.yaml: -------------------------------------------------------------------------------- 1 | {{- $architecture := or .architecture "i386" -}} 2 | 3 | architecture: {{$architecture}} 4 | 5 | actions: 6 | - action: run 7 | description: Install bootloader 8 | chroot: true 9 | command: > 10 | {{if eq $architecture "i386" "amd64"}} 11 | update-grub 12 | && grub-install /dev/disk/by-id/virtio-fakedisk-0 13 | {{end}} 14 | -------------------------------------------------------------------------------- /docs/bugs.md: -------------------------------------------------------------------------------- 1 | # Bugs # 2 | 3 | If I am not aware of the bugs I can not fix 'em. 4 | The list of known bugs is at project page: 5 | 6 | - 7 | 8 | Submit bugs there or send them to henqvist at users.sourceforge.net, 9 | please put the word 'pinball' somewhere in the subject 10 | otherwise it may go in the thrash as spam (99% of the english mail I get is spam). 11 | -------------------------------------------------------------------------------- /extra/profile/pinball/etc/pinball/pinball: -------------------------------------------------------------------------------- 1 | size: 512 512 2 | sound: 8 3 | music: 8 4 | view: 1 5 | bpp: 16 6 | fullscreen: 0 7 | lights: 1 8 | brightness: 0.5 9 | texture_filter: 0 10 | showfps: 1 11 | fire: 1 12 | keyboard: bottomnudge 32 13 | keyboard: launch 13 14 | keyboard: leftflip 1073742049 15 | keyboard: leftnudge 1073742048 16 | keyboard: reset 114 17 | keyboard: rightflip 1073742053 18 | keyboard: rightnudge 1073742052 19 | -------------------------------------------------------------------------------- /extra/profile/pincab/etc/pinball/pinball: -------------------------------------------------------------------------------- 1 | size: 768 1024 2 | sound: 8 3 | music: 8 4 | view: 4 5 | bpp: 16 6 | fullscreen: 1 7 | lights: 1 8 | brightness: 0.5 9 | texture_filter: 0 10 | showfps: 1 11 | fire: 1 12 | keyboard: bottomnudge 32 13 | keyboard: launch 13 14 | keyboard: leftflip 1073742049 15 | keyboard: leftnudge 1073742048 16 | keyboard: reset 114 17 | keyboard: rightflip 1073742053 18 | keyboard: rightnudge 1073742052 19 | ratio: 0.384 20 | -------------------------------------------------------------------------------- /docs/download.md: -------------------------------------------------------------------------------- 1 | # Download # 2 | 3 | Download the latest release, 4 | 0.3.0 from the files sections at the project page at sourceforge. 5 | 6 | The rpm packages are for Red Hat 8.0. 7 | There is also some Mandrake binares on rpmfind 8 | and Debian package are also available from www.debian.org 9 | in the testing distribution (although they are really old at the moment). 10 | 11 | These packages are updated by other people 12 | so it may take some days (weeks) before the latest release is available. 13 | -------------------------------------------------------------------------------- /extra/debos/machine/rpi_4/image.yaml: -------------------------------------------------------------------------------- 1 | {{- $architecture := or .architecture "arm64" -}} 2 | {{- $kernel := or .kernel "linux-image-generic" -}} 3 | {{- $machine := or .machine "rpi_4" -}} 4 | {{- $suite := or .suite "bullseye" -}} 5 | 6 | architecture: {{$architecture}} 7 | 8 | actions: 9 | 10 | - action: recipe 11 | recipe: ../rpi_2/image.yaml 12 | variables: 13 | architecture: {{$architecture}} 14 | kernel: {{$kernel}} 15 | machine: {{$machine}} 16 | suite: {{$suite}} 17 | -------------------------------------------------------------------------------- /extra/debos/machine/rpi_3_32b/image.yaml: -------------------------------------------------------------------------------- 1 | {{- $architecture := or .architecture "armhf" -}} 2 | {{- $kernel := or .kernel "linux-image-armmp" -}} 3 | {{- $machine := or .machine "rpi_3_32b" -}} 4 | {{- $suite := or .suite "bullseye" -}} 5 | 6 | architecture: {{$architecture}} 7 | 8 | actions: 9 | 10 | - action: recipe 11 | recipe: ../rpi_2/image.yaml 12 | variables: 13 | architecture: {{$architecture}} 14 | kernel: {{$kernel}} 15 | machine: {{$machine}} 16 | suite: {{$suite}} 17 | -------------------------------------------------------------------------------- /extra/debos/machine/rpi_3_64b/image.yaml: -------------------------------------------------------------------------------- 1 | {{- $architecture := or .architecture "arm64" -}} 2 | {{- $kernel := or .kernel "linux-image-generic" -}} 3 | {{- $machine := or .machine "rpi_3_64b" -}} 4 | {{- $suite := or .suite "bullseye" -}} 5 | 6 | architecture: {{$architecture}} 7 | 8 | actions: 9 | 10 | - action: recipe 11 | recipe: ../rpi_2/image.yaml 12 | variables: 13 | architecture: {{$architecture}} 14 | kernel: {{$kernel}} 15 | machine: {{$machine}} 16 | suite: {{$suite}} 17 | -------------------------------------------------------------------------------- /extra/debos/machine/generic/pinball-i386.yaml: -------------------------------------------------------------------------------- 1 | {{- $architecture := or .architecture "i386" -}} 2 | {{- $machine := or .machine "generic" -}} 3 | {{- $mirror := or .mirror "https://deb.debian.org/debian" -}} 4 | {{- $suite := or .suite "bullseye" -}} 5 | 6 | architecture: {{$architecture}} 7 | 8 | actions: 9 | 10 | - action: recipe 11 | recipe: ../../pinball.yaml 12 | variables: 13 | architecture: {{$architecture}} 14 | machine: {{$machine}} 15 | mirror: {{$mirror}} 16 | suite: {{$suite}} 17 | -------------------------------------------------------------------------------- /extra/debos/machine/rpi_2/pinball-rpi_2.yaml: -------------------------------------------------------------------------------- 1 | {{- $architecture := or .architecture "armhf" -}} 2 | {{- $machine := or .machine "rpi_2" -}} 3 | {{- $suite := or .suite "bullseye" -}} 4 | {{- $uboot_machine := or .uboot_machine "rpi_2" -}} 5 | 6 | architecture: {{$architecture}} 7 | 8 | actions: 9 | 10 | - action: recipe 11 | recipe: ../../pinball.yaml 12 | variables: 13 | architecture: {{$architecture}} 14 | machine: {{$machine}} 15 | suite: {{$suite}} 16 | uboot_machine: {{$uboot_machine}} 17 | -------------------------------------------------------------------------------- /extra/debos/machine/generic/pinball-amd64.yaml: -------------------------------------------------------------------------------- 1 | {{- $architecture := or .architecture "amd64" -}} 2 | {{- $machine := or .machine "generic" -}} 3 | {{- $mirror := or .mirror "https://deb.debian.org/debian" -}} 4 | {{- $suite := or .suite "bullseye" -}} 5 | 6 | architecture: {{$architecture}} 7 | 8 | actions: 9 | 10 | - action: recipe 11 | recipe: ../../pinball.yaml 12 | variables: 13 | architecture: {{$architecture}} 14 | machine: {{$machine}} 15 | mirror: {{$mirror}} 16 | suite: {{$suite}} 17 | -------------------------------------------------------------------------------- /base/Camera.cpp: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | Camera.cpp - description 3 | ------------------- 4 | begin : Fri Jan 28 2000 5 | copyright : (C) 2000 by 6 | email : 7 | ***************************************************************************/ 8 | 9 | #include "Private.h" 10 | #include "Camera.h" 11 | 12 | Camera::Camera() { 13 | } 14 | 15 | Camera::~Camera() { 16 | } 17 | -------------------------------------------------------------------------------- /docs/editor.md: -------------------------------------------------------------------------------- 1 | # Building your own tables # 2 | 3 | Those who want to build their own tables can download the in-house table editor for the game. 4 | It is basically a simple 3D-modeller which allows you to edit the statemachines of objects. 5 | Currently it uses its own file format but support for importing other 3D file formats is on its way. 6 | The editor only works on linux and other QT 3.x.x friendly environments. 7 | Download it as a seperate package from sourceforge, pinedit. 8 | The editor requies that the latest version of pinball is installed. 9 | 10 | 11 | -------------------------------------------------------------------------------- /extra/debos/machine/rpi_3_32b/actions.yaml: -------------------------------------------------------------------------------- 1 | {{- $architecture := or .architecture "armhf" -}} 2 | {{- $kernel := or .kernel "linux-image-armmp" -}} 3 | {{- $machine := or .machine "rpi_3_32b" -}} 4 | {{- $suite := or .suite "bullseye" -}} 5 | {{- $uboot_machine := or .uboot_machine "rpi_3_32b" -}} 6 | 7 | architecture: {{$architecture}} 8 | 9 | actions: 10 | 11 | - action: recipe 12 | recipe: ../rpi_2/actions.yaml 13 | variables: 14 | architecture: {{$architecture}} 15 | kernel: {{$kernel}} 16 | machine: {{$machine}} 17 | suite: {{$suite}} 18 | uboot_machine: {{$uboot_machine}} 19 | -------------------------------------------------------------------------------- /extra/debos/machine/rpi_4/actions.yaml: -------------------------------------------------------------------------------- 1 | {{- $architecture := or .architecture "arm64" -}} 2 | {{- $kernel := or .kernel "linux-image-generic" -}} 3 | {{- $machine := or .machine "rpi_4" -}} 4 | {{- $suite := or .suite "bullseye" -}} 5 | {{- $uboot_machine := or .uboot_machine "rpi4" -}} 6 | 7 | architecture: {{$architecture}} 8 | 9 | actions: 10 | 11 | - action: recipe 12 | recipe: ../rpi_2/actions.yaml 13 | variables: 14 | architecture: {{$architecture}} 15 | kernel: {{$kernel}} 16 | machine: {{$machine}} 17 | suite: {{$suite}} 18 | uboot_machine: {{$uboot_machine}} 19 | 20 | -------------------------------------------------------------------------------- /extra/debos/machine/rpi_4/pinball-rpi_4.yaml: -------------------------------------------------------------------------------- 1 | {{- $architecture := or .architecture "arm64" -}} 2 | {{- $machine := or .machine "rpi_4" -}} 3 | {{- $mirror := or .mirror "https://deb.debian.org/debian" -}} 4 | {{- $suite := or .suite "bullseye" -}} 5 | {{- $uboot_machine := or .uboot_machine "rpi_4" -}} 6 | 7 | architecture: {{$architecture}} 8 | 9 | actions: 10 | 11 | - action: recipe 12 | recipe: ../../pinball.yaml 13 | variables: 14 | architecture: {{$architecture}} 15 | machine: {{$machine}} 16 | mirror: {{$mirror}} 17 | suite: {{$suite}} 18 | uboot_machine: {{$uboot_machine}} 19 | -------------------------------------------------------------------------------- /extra/debos/machine/rpi_3_32b/pinball-rpi_3_32b.yaml: -------------------------------------------------------------------------------- 1 | {{- $architecture := or .architecture "armhf" -}} 2 | {{- $image := or .image "pinball-rpi_3_32b.img" -}} 3 | {{- $machine := or .machine "rpi_3_32b" -}} 4 | {{- $suite := or .suite "bullseye" -}} 5 | {{- $uboot_machine := or .uboot_machine "rpi_3_32b" -}} 6 | 7 | architecture: {{$architecture}} 8 | 9 | actions: 10 | 11 | - action: recipe 12 | recipe: ../../pinball.yaml 13 | variables: 14 | architecture: {{$architecture}} 15 | image: {{$image}} 16 | machine: {{$machine}} 17 | suite: {{$suite}} 18 | uboot_machine: {{$uboot_machine}} 19 | -------------------------------------------------------------------------------- /.github/workflows/fediverse-action.yml: -------------------------------------------------------------------------------- 1 | # YAML 2 | --- 3 | name: fediverse-action 4 | on: [push] 5 | jobs: 6 | post: 7 | runs-on: ubuntu-latest 8 | steps: 9 | - uses: actions/checkout@v1 10 | - id: log 11 | run: echo "::set-output name=message::$(git log --no-merges -1 --oneline)" 12 | - if: "contains(steps.log.outputs.message, 'Release ')" 13 | uses: rzr/fediverse-action@master 14 | with: 15 | access-token: ${{ secrets.MASTODON_ACCESS_TOKEN }} 16 | message: "https://github.com/${{ github.repository }}/commit/${{ steps.log.outputs.message }} ~ #FediVerseAction" 17 | -------------------------------------------------------------------------------- /extra/debos/machine/rpi_3_64b/actions.yaml: -------------------------------------------------------------------------------- 1 | {{- $architecture := or .architecture "arm64" -}} 2 | {{- $kernel := or .kernel "linux-image-generic" -}} 3 | {{- $machine := or .machine "rpi_3_64b" -}} 4 | {{- $suite := or .suite "bullseye" -}} 5 | {{- $uboot_machine := or .uboot_machine "rpi_3" -}} 6 | 7 | architecture: {{$architecture}} 8 | 9 | actions: 10 | 11 | - action: recipe 12 | recipe: ../rpi_2/actions.yaml 13 | variables: 14 | architecture: {{$architecture}} 15 | kernel: {{$kernel}} 16 | machine: {{$machine}} 17 | suite: {{$suite}} 18 | uboot_machine: {{$uboot_machine}} 19 | -------------------------------------------------------------------------------- /debian/clean: -------------------------------------------------------------------------------- 1 | compile 2 | config.sub 3 | config.guess 4 | config.status 5 | config.log 6 | configure 7 | configure.tmp 8 | depcomp 9 | pinball.6 10 | manpage.links 11 | manpage.refs 12 | manpage.log 13 | aclocal.m4 14 | ltmain.sh 15 | stamp-h.in 16 | install-sh 17 | pinconfig.h.in~ 18 | pinconfig.h.in 19 | libtool 20 | missing 21 | Makefile.in 22 | addon/Makefile.in 23 | base/Makefile.in 24 | data/Makefile.in 25 | data/tux/Makefile.in 26 | data/professor/Makefile.in 27 | src/Makefile.in 28 | test/Makefile.in 29 | debian/stamp-patched 30 | *.o 31 | missing 32 | mkinstalldirs 33 | install-sh 34 | autom4te.cache/* 35 | compile 36 | INSTALL 37 | depcomp 38 | README 39 | -------------------------------------------------------------------------------- /extra/debos/machine/rpi_2/image.yaml: -------------------------------------------------------------------------------- 1 | {{- $architecture := or .architecture "armhf" -}} 2 | 3 | architecture: {{$architecture}} 4 | 5 | actions: 6 | - action: run 7 | description: Update weston default output 8 | chroot: true 9 | command: > 10 | sed -e 's|Virtual-1|HDMI-A-1|g' -i /etc/xdg/weston/weston.ini 11 | 12 | - action: run 13 | description: Check bootloader 14 | chroot: true 15 | command: > 16 | find /boot \ 17 | /boot/firmware \ 18 | /usr/lib/u-boot/ \ 19 | && ls /boot/firmware/u-boot.bin 20 | && cat /boot/firmware/config.txt 21 | && cat /boot/extlinux/extlinux.conf 22 | && ls /boot/vmlinuz* 23 | -------------------------------------------------------------------------------- /base/Behavior.cpp: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | Behavior.cpp - description 3 | ------------------- 4 | begin : Wed Jan 26 2000 5 | copyright : (C) 2000 by Henrik Enqvist GPL 6 | email : henqvist@excite.com 7 | ***************************************************************************/ 8 | 9 | #include "Private.h" 10 | #include "Behavior.h" 11 | #include "Group.h" 12 | 13 | #include 14 | 15 | Behavior::Behavior() { 16 | //EM_COUT("Behavior::Behavior", 1); 17 | p_Light = NULL; 18 | p_Parent = NULL; 19 | m_iType = 0; 20 | } 21 | 22 | -------------------------------------------------------------------------------- /addon/BigSphere.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | BigSphere.h - description 3 | ------------------- 4 | begin : Wed Jan 26 2000 5 | copyright : (C) 2000 by Henrik Enqvist 6 | email : henqvist@excite.com 7 | ***************************************************************************/ 8 | 9 | #ifndef BIGSPHERE_H 10 | #define BIGSPHERE_H 11 | 12 | #include "Shape3D.h" 13 | 14 | /** */ 15 | class BigSphere : public Shape3D { 16 | public: 17 | BigSphere(float fSize, int level, float fR, float fG, float fB, float fA); 18 | }; 19 | 20 | #endif // SPHERE_H 21 | -------------------------------------------------------------------------------- /extra/debos/machine/rpi_3_64b/pinball-rpi_3_64b.yaml: -------------------------------------------------------------------------------- 1 | {{- $architecture := or .architecture "arm64" -}} 2 | {{- $image := or .image "pinball-rpi_3_64b.img" -}} 3 | {{- $kernel := or .kernel "linux-image-generic" -}} 4 | {{- $machine := or .machine "rpi_3_64b" -}} 5 | {{- $suite := or .suite "bullseye" -}} 6 | {{- $uboot_machine := or .uboot_machine "rpi_3" -}} 7 | 8 | architecture: {{$architecture}} 9 | 10 | actions: 11 | 12 | - action: recipe 13 | recipe: ../../pinball.yaml 14 | variables: 15 | architecture: {{$architecture}} 16 | image: {{$image}} 17 | kernel: {{$kernel}} 18 | machine: {{$machine}} 19 | suite: {{$suite}} 20 | uboot_machine: {{$uboot_machine}} 21 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | Lead developer: Henrik Enqvist 2 | Porting, coding: Philippe Coval 3 | Coding: Pedro Ferreira 4 | Debian contributors: 5 | Didier Dhollande 6 | Innocent De Marchi 7 | 2002 Yann Dirson 8 | 2004 Helge Kreutzmann 9 | 2004 Matt Zimmerman 10 | 2004-2010 Jochen Friedrich 11 | 2006 Matthias Klose 12 | 2011 Regis Boudin 13 | 2014-2016 Markus Koschany 14 | 2016 Neil Roeth 15 | 2018 Innocent De Marchi 16 | -------------------------------------------------------------------------------- /addon/Makefile.am: -------------------------------------------------------------------------------- 1 | AUTOMAKE_OPTIONS = gnu 2 | 3 | pinlibdir = $(libdir)/pinball 4 | pinincludedir = $(includedir)/pinball 5 | 6 | pinlib_LIBRARIES = libemilia_addon.a 7 | 8 | AM_CPPFLAGS = -I../base 9 | 10 | libemilia_addon_a_SOURCES = \ 11 | BigSphere.cpp \ 12 | ColorBehavior.cpp \ 13 | Cone.cpp \ 14 | Cube.cpp \ 15 | Cylinder.cpp \ 16 | Grid.cpp \ 17 | KeyBehavior.cpp \ 18 | KeyRotBehavior.cpp \ 19 | Menu.cpp \ 20 | Sphere.cpp \ 21 | StdAnimation.cpp \ 22 | TexAnimation.cpp 23 | 24 | pininclude_HEADERS = \ 25 | BigSphere.h \ 26 | ColorBehavior.h \ 27 | Cone.h \ 28 | Cube.h \ 29 | Cylinder.h \ 30 | Grid.h \ 31 | KeyBehavior.h \ 32 | KeyRotBehavior.h \ 33 | Menu.h \ 34 | Sphere.h \ 35 | StdAnimation.h \ 36 | TexAnimation.h 37 | -------------------------------------------------------------------------------- /debian/pinball.postinst: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | set -e 4 | 5 | if [ "$1" = "configure" ] ; then 6 | 7 | TABLES="professor tux" 8 | 9 | if [ ! -d /var/games ]; then 10 | mkdir /var/games 11 | fi 12 | 13 | if [ ! -d /var/games/pinball ]; then 14 | mkdir /var/games/pinball 15 | fi 16 | 17 | for DIRS in $TABLES; do 18 | 19 | if [ ! -d /var/games/pinball/$DIRS ]; then 20 | mkdir /var/games/pinball/$DIRS 21 | fi 22 | 23 | if [ -e /var/games/pinball/$DIRS/highscores ]; then 24 | continue 25 | fi 26 | 27 | touch /var/games/pinball/$DIRS/highscores 28 | chown root:games /var/games/pinball/$DIRS/highscores 29 | chmod 664 /var/games/pinball/$DIRS/highscores 30 | done 31 | 32 | fi 33 | 34 | #DEBHELPER# 35 | -------------------------------------------------------------------------------- /addon/Sphere.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | Sphere.h - description 3 | ------------------- 4 | begin : Wed Jan 26 2000 5 | copyright : (C) 2000 by Henrik Enqvist 6 | email : henqvist@excite.com 7 | ***************************************************************************/ 8 | 9 | #ifndef SPHERE_H 10 | #define SPHERE_H 11 | 12 | #include "Shape3D.h" 13 | 14 | /** The BigSphere class is a nicer than this sphere. @see BigSphere */ 15 | class Sphere : public Shape3D { 16 | public: 17 | Sphere(float fSize, float fR, float fG, float fB, float fA); 18 | }; 19 | 20 | #endif // SPHERE_H 21 | -------------------------------------------------------------------------------- /ChangeLog: -------------------------------------------------------------------------------- 1 | 2 | 0.1.3 3 | - Fixed collision bug. 4 | 5 | forgott a lot of stuff 6 | 7 | 0.0.3 8 | - Polygon intersection speed up. 9 | - Command line parse error fix. 10 | - OpenGL polygon state switch speed up (speed up ~30). 11 | - Textured polygon instead of rasters for fonts, (speed up ~20%). 12 | - New font file type, 256x256 png-file. 13 | - Experimental, not compiled by default: Threaded rendering, (speed down/up -10% -> +10%). 14 | - Cache in SoundUtil. 15 | - Behaviors loads sounds instead of Score. 16 | - 'Screen goes black'-bug fixed. 17 | - New sounds. 18 | - Extra ball. 19 | - Fixed png check in configure.in. 20 | 21 | 0.0.2 22 | Multiball. 23 | Right ramp. 24 | Jackpot. 25 | Cache in TextureUtil. 26 | 27 | 0.0.1 28 | First alpha release 29 | -------------------------------------------------------------------------------- /extra/profile/pinball/etc/pinball/weston.service: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-2.0+ 2 | 3 | [Unit] 4 | Description=Weston Wayland compositor startup 5 | RequiresMountsFor=/run 6 | 7 | [Service] 8 | Type=simple 9 | User=root 10 | EnvironmentFile=-/etc/pinball/weston.env.sh 11 | Environment="XDG_RUNTIME_DIR=/run/user/0" 12 | Environment="DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/root/dbus/user_bus_socket" 13 | ExecStartPre=/usr/bin/sudo /bin/mkdir -p /run/user/0/dbus 14 | ExecStartPre=/usr/bin/sudo /bin/chown -R root:root /run/user/0/dbus 15 | ExecStartPre=/bin/chmod -R 0700 /run/user/0 16 | ExecStart=/usr/bin/openvt -v -w -s -- su root -l -c "/usr/bin/weston-launch -- 2>&1 | tee /var/log/weston.log" 17 | 18 | [Install] 19 | Alias=display-manager.service 20 | WantedBy=graphical.target 21 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing to pinball # 2 | 3 | Upstream project is located at: 4 | 5 | - https://sourceforge.net/p/pinball/ 6 | 7 | But current maintainer would prefer to review patches using git, 8 | feel free to open pull requests at: 9 | 10 | - https://github.com/rzr/pinball 11 | 12 | Extra tables are also welcome but they should be maintained in separate projects, 13 | try to align structure to existing ones: 14 | 15 | - https://github.com/rzr/pinball-table-gnu 16 | - https://github.com/rzr/pinball-table-hurd 17 | 18 | ## Coding Styles ## 19 | 20 | Unless the code is linted, please try to align the current style 21 | 22 | ## License ## 23 | 24 | By contributing to OpenAirInterface, you agree that your contributions will be licensed under the LICENSE file in the root directory of this source tree. 25 | -------------------------------------------------------------------------------- /addon/Cube.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | Cube.h - description 3 | ------------------- 4 | begin : Wed Jan 26 2000 5 | copyright : (C) 2000 by 6 | email : 7 | ***************************************************************************/ 8 | 9 | #ifndef CUBE_H 10 | #define CUBE_H 11 | 12 | #include "Shape3D.h" 13 | /** A simple cube. @see Shape3D */ 14 | class Cube : public Shape3D { 15 | public: 16 | /** Cube(size, r, g, b, a). You must enable transaparency to be able to 17 | * use the alpha color. */ 18 | Cube(float size, float r, float g, float b, float a); 19 | /** Cube(size, textureAppliedToEverySide). */ 20 | Cube(float, EmTexture*); 21 | }; 22 | 23 | #endif // CUBE_H 24 | -------------------------------------------------------------------------------- /addon/Cone.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | Cone.h - description 3 | ------------------- 4 | begin : Wed Jan 26 2000 5 | copyright : (C) 2000 by Henrik Enqvist 6 | email : henqvist@excite.com 7 | ***************************************************************************/ 8 | 9 | #ifndef CONE_H 10 | #define CONE_H 11 | 12 | #include "EMath.h" 13 | #include "Shape3D.h" 14 | 15 | /** A simple cone. @see Shape3D */ 16 | class Cone : public Shape3D { 17 | public: 18 | /** Cone(size, r, g, b, a). Color given by r, g, b and a. You must enable 19 | * transparency to use the alpha color. */ 20 | Cone(float size, int sides, float r, float g, float b, float a); 21 | }; 22 | 23 | #endif // CONE_H 24 | -------------------------------------------------------------------------------- /addon/Cylinder.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | Cylinder.h - description 3 | ------------------- 4 | begin : Wed Jan 26 2000 5 | copyright : (C) 2000 by 6 | email : 7 | ***************************************************************************/ 8 | 9 | #ifndef CYLINDER_H 10 | #define CYLINDER_H 11 | 12 | #include "EMath.h" 13 | #include "Shape3D.h" 14 | /** A simple cylinder. @see Shape3D */ 15 | class Cylinder : public Shape3D { 16 | public: 17 | /** Cylinder(size, sides, r, g, b, a). You must enable transparency to be able 18 | * to use the alpha color. */ 19 | Cylinder(float size, int sides, float r, float g, float b, float a, bool bTop = true); 20 | }; 21 | 22 | #endif // SPHERE_H 23 | -------------------------------------------------------------------------------- /base/SoundVisitor.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | SoundVisitor.h - description 3 | ------------------- 4 | begin : Wed Jan 26 2000 5 | copyright : (C) 2000 by Henrik Enqvist 6 | email : henqvist@excite.com 7 | ***************************************************************************/ 8 | 9 | #ifndef SOUNDVISITOR_H 10 | #define SOUNDVISITOR_H 11 | 12 | #include "Visitor.h" 13 | 14 | class Group; 15 | /** @author Henrik Enqvist */ 16 | class SoundVisitor : public Visitor { 17 | protected: 18 | SoundVisitor(); 19 | public: 20 | ~SoundVisitor(); 21 | static SoundVisitor * getInstance(); 22 | void visit(Group*); 23 | private: 24 | static SoundVisitor * p_SoundVisitor; 25 | }; 26 | 27 | #endif // SOUNDVISITOR_H 28 | -------------------------------------------------------------------------------- /test/moduletest.cpp: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | module.cpp - description 3 | ------------------- 4 | begin : Sun Sep 22 2002 5 | copyright : (C) 2002 by Henrik Enqvist 6 | email : henqvist@excite.com 7 | ***************************************************************************/ 8 | 9 | #include 10 | #include "Private.h" 11 | #include "Behavior.h" 12 | 13 | 14 | class MyBehavior : public Behavior { 15 | public: 16 | MyBehavior() : Behavior() {}; 17 | ~MyBehavior() {}; 18 | void onTick() {}; 19 | void onCollision(const Vertex3D & vtxWall, const Vertex3D & vtxOwn, Group * g) {}; 20 | void onSignal(int signal, Group * sender) {}; 21 | }; 22 | 23 | extern "C" void * new_object_fct(void) { 24 | return new MyBehavior(); 25 | } 26 | -------------------------------------------------------------------------------- /pinball.appdata.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | pinball.desktop 4 | CC0-1.0 5 | GPL-2.0+ 6 | Emilia Pinball 7 | 3D Pinball Game 8 | 9 |

10 | The Emilia Pinball project is an open source pinball simulator 11 | by Henrik Enqvist. 12 |

13 |

14 | The current release features a number of tables: 15 | tux, professor 16 | and is very addictive. 17 |

18 |
19 | http://pinball.sourceforge.net/ 20 | 21 | http://repo.openpandora.org/files/pnd/pinball_ptitseb/preview1.png 22 | 23 | jwrdegoede_at_fedoraproject.org 24 |
25 | -------------------------------------------------------------------------------- /base/BehaviorVisitor.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | BehaviorVisitor.h - description 3 | ------------------- 4 | begin : Wed Jan 26 2000 5 | copyright : (C) 2000 by Henrik Enqvist 6 | email : henqvist@excite.com 7 | ***************************************************************************/ 8 | 9 | #ifndef BEHAVIORVISITOR_H 10 | #define BEHAVIORVISITOR_H 11 | 12 | #include "Visitor.h" 13 | 14 | class Group; 15 | /** Only for internal use. @see Visitor */ 16 | class BehaviorVisitor : public Visitor { 17 | protected: 18 | BehaviorVisitor(); 19 | public: 20 | ~BehaviorVisitor(); 21 | static BehaviorVisitor * getInstance(); 22 | void visit(Group*); 23 | private: 24 | static BehaviorVisitor * p_BehaviorVisitor; 25 | }; 26 | 27 | #endif // BEHAVIORVISITOR_H 28 | -------------------------------------------------------------------------------- /docs/index.md: -------------------------------------------------------------------------------- 1 | # EMILIA PINBALL DOCS # 2 | 3 | The Emilia Pinball project is an open source pinball simulator 4 | intended for linux machines by Henrik Enqvist. 5 | It has been reported to work on other unix variants also. 6 | Now a days there is also a win***s version, and a mac version might be on its way. 7 | 8 | Porting it to other systems should be easy 9 | as long as OpenGL and SDL (or Allegro) are working. 10 | 11 | There is both an hardware accelerated version using SDL and OpenGL 12 | as well as an software version using Allegro available. 13 | 14 | The Allegro version is always a bit behind in development 15 | and has more bugs than the SDL/OpenGL version. 16 | 17 | ## REQUIREMENTS ## 18 | 19 | - Some sort of linux or unix box. 20 | - 300 Mhz cpu (450 Mhz for software rendering). 21 | - OpenGL compatible 3D card, OpenGL/Mesa and glut installed. 22 | - The SDL, SDL_image and SDL_mixer library 23 | - Same for 24 | -------------------------------------------------------------------------------- /base/TransformVisitor.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | TVisitor.h - description 3 | ------------------- 4 | begin : Wed Jan 26 2000 5 | copyright : (C) 2000 by Henrik Enqvist 6 | email : henqvist@excite.com 7 | ***************************************************************************/ 8 | 9 | #ifndef TRANSFORMVISITOR_H 10 | #define TRANSFORMVISITOR_H 11 | 12 | #include "Visitor.h" 13 | #include "EMath.h" 14 | 15 | /** Only for internal use. */ 16 | class TransformVisitor : public Visitor { 17 | protected: 18 | TransformVisitor(); 19 | public: 20 | ~TransformVisitor(); 21 | static TransformVisitor * getInstance(); 22 | void setCamera(Group*); 23 | void visit(Group*); 24 | void empty(); 25 | private: 26 | Group* p_GroupCamera; 27 | static TransformVisitor * p_TransformVisitor; 28 | }; 29 | 30 | #endif // TRANSFORMVISITOR_H 31 | -------------------------------------------------------------------------------- /test/unittest.cpp: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | Unit test runner 3 | ***************************************************************************/ 4 | 5 | #include "Private.h" 6 | #include "TextureUtil.h" 7 | 8 | #include 9 | 10 | #if EM_UNIT_TEST 11 | #include 12 | #include "Private.h" 13 | #include "SrcTest.h" 14 | #include "BaseTest.h" 15 | #endif 16 | 17 | /** Main */ 18 | int main(int argc, char *argv[]) { 19 | #if EM_UNIT_TEST 20 | CppUnit::TextUi::TestRunner runner; 21 | runner.addTest(EMathTest::suite()); 22 | runner.addTest(LoaderTest::suite()); 23 | runner.addTest(ScriptTest::suite()); 24 | runner.addTest(StateBehaviorTest::suite()); 25 | runner.addTest(ShapeTest::suite()); 26 | runner.run(); 27 | #else 28 | cerr << "Unittest support not found, install cppunit and reconfigure!" << endl; 29 | #endif 30 | return 0; 31 | } 32 | 33 | #if EM_USE_ALLEGRO 34 | END_OF_MAIN(); 35 | #endif 36 | -------------------------------------------------------------------------------- /addon/KeyBehavior.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | KeyBehavior.h - description 3 | ------------------- 4 | begin : Wed Jan 26 2000 5 | copyright : (C) 2000 by Henrik Enqvist 6 | email : henqvist@excite.com 7 | ***************************************************************************/ 8 | 9 | #ifndef KEYBEHAVIOR_H 10 | #define KEYBEHAVIOR_H 11 | 12 | #include "Behavior.h" 13 | 14 | /** A Behavior that lets the users move the group with A, S, D, Q, W, E keys. 15 | * Simply add a KeyBehavior object to a group to be able to move it. */ 16 | class KeyBehavior : public Behavior { 17 | public: 18 | KeyBehavior(); 19 | ~KeyBehavior(); 20 | void onTick(); 21 | virtual void onCollision(const Vertex3D &, const Vertex3D &, Group *) {}; 22 | virtual void onSignal(int, Group *) {}; 23 | private: 24 | float m_x, m_y, m_z; 25 | }; 26 | 27 | #endif // KEYBEHAVIOR_H 28 | -------------------------------------------------------------------------------- /base/RenderVisitor.cpp: -------------------------------------------------------------------------------- 1 | // -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- 2 | // SPDX-License-Identifier: GPL-2.0+ 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | #include "Private.h" 9 | #include "RenderVisitor.h" 10 | #include "OpenGLVisitor.h" 11 | #include "AllegroVisitor.h" 12 | 13 | 14 | using namespace std; 15 | 16 | 17 | RenderVisitor* RenderVisitor::getInstance() 18 | { 19 | static RenderVisitor* pInstance = NULL; 20 | 21 | if (!pInstance) { 22 | char* text = getenv("PINBALL_RENDER_DRIVER"); 23 | if (text) { 24 | cerr << "PINBALL_RENDER_DRIVER=\""<< text<<"\""<p_Sound != NULL) { 32 | g->p_Sound->adjust(); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /base/OpenGLVisitor.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | OpenGLVisitor.h - description 3 | ------------------- 4 | begin : Sat Jan 6 2001 5 | copyright : (C) 2001 by Henrik Enqvist 6 | email : henqvist@excite.com 7 | ***************************************************************************/ 8 | 9 | 10 | #ifndef OPENGLVISITOR_H 11 | #define OPENGLVISITOR_H 12 | 13 | #include "RenderVisitor.h" 14 | 15 | #define EM_GL_GCOL_TEX 0 16 | #define EM_GL_GCOL_TEX_TRANS 2 17 | #define EM_GL_CLEAN 4 18 | 19 | 20 | class OpenGLVisitor 21 | : public RenderVisitor 22 | { 23 | public: 24 | static OpenGLVisitor* getInstance(); 25 | public: 26 | virtual void visit(Group* g); 27 | virtual void empty(); 28 | protected: 29 | OpenGLVisitor(); 30 | virtual ~OpenGLVisitor(); 31 | protected: 32 | static OpenGLVisitor* p_OpenGLVisitor; 33 | }; 34 | 35 | #endif // OPENGLVISITOR_H 36 | 37 | -------------------------------------------------------------------------------- /test/joy.cpp: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | Joystick test 3 | ***************************************************************************/ 4 | 5 | #include 6 | 7 | #include "Private.h" 8 | #include "Engine.h" 9 | #include "Keyboard.h" 10 | 11 | /** Main */ 12 | int main(int argc, char *argv[]) { 13 | #if EM_USE_SDL 14 | cerr << "Joystick test" << endl; 15 | Engine* engine = new Engine(argc, argv); 16 | 17 | int njoystick = SDL_NumJoysticks(); 18 | cerr << njoystick << " joysticks were found." << endl; 19 | 20 | if (njoystick != 0) { 21 | cerr << "The names of the joysticks are:" << endl; 22 | for(int a=0; atick(); 29 | engine->render(); 30 | engine->swap(); 31 | } 32 | 33 | delete(engine); 34 | #else 35 | #warning "this is sdl specific test" 36 | #endif 37 | return 0; 38 | } 39 | 40 | #if EM_USE_ALLEGRO 41 | END_OF_MAIN(); 42 | #endif 43 | -------------------------------------------------------------------------------- /addon/TexAnimation.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | Animation.h - description 3 | ------------------- 4 | begin : Wed Jan 26 2000 5 | copyright : (C) 2000 by 6 | email : 7 | ***************************************************************************/ 8 | 9 | #ifndef TEXANIMATION_H 10 | #define TEXANIMATION_H 11 | 12 | #include "EMath.h" 13 | #include "Behavior.h" 14 | #include "StateMachine.h" 15 | 16 | class Group; 17 | 18 | /** @see Group */ 19 | class TexAnimation : public Behavior { 20 | public: 21 | /** Animation(stepsize, nvertex, type). */ 22 | TexAnimation(int step, int nvtx); 23 | ~TexAnimation(); 24 | void onTick(); 25 | void add(float, float); 26 | void onCollision(const Vertex3D &, const Vertex3D &, Group *) {}; 27 | void onSignal(int, Group *) {}; 28 | private: 29 | vector m_vTexCoord; 30 | int m_iStep; 31 | int m_iTick; 32 | int m_iTexCoord; 33 | }; 34 | 35 | #endif // TEXANIMATION_H 36 | -------------------------------------------------------------------------------- /base/Camera.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | camera.h - description 3 | ------------------- 4 | begin : Fri Jan 28 2000 5 | copyright : (C) 2000 by Henrik Enqvist 6 | email : henqvist@excite.com 7 | ***************************************************************************/ 8 | 9 | #ifndef CAMERA_H 10 | #define CAMERA_H 11 | 12 | /** Every engine needs a camera. The camera is the viewer of the world. 13 | * The camera is added to the engine with the "setEngineCamera" function. 14 | * If you want to move the camera around you should add it to a group. 15 | *

Example:

16 | * Group* groupC = new Group(1);
17 | * Camera* camera = new Camera();
18 | *
19 | * engine->add(groupC);
20 | * groupC->add(camera);
21 | *
22 | * engine->setEngineCamera(groupC);
23 | *

24 | * @see Engine */ 25 | class Camera { 26 | public: 27 | Camera(); 28 | ~Camera(); 29 | }; 30 | 31 | #endif // CAMERA_H 32 | -------------------------------------------------------------------------------- /addon/ColorBehavior.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | ColorBehavior.h - description 3 | ------------------- 4 | begin : Tue Feb 15 2000 5 | copyright : (C) 2000 by Henrik Enqvist 6 | email : henqvist@excite.com 7 | ***************************************************************************/ 8 | 9 | #ifndef COLORBEHAVIOR_H 10 | #define COLORBEHAVIOR_H 11 | 12 | #include "Behavior.h" 13 | #include "EMath.h" 14 | #include "StateMachine.h" 15 | 16 | /** A simple behavior that changes the color of all polygons in the Shape3D 17 | * to blue and then when collision occurs all polygons are changed to red. 18 | * The collision example uses this to demonstrate when collision is 19 | * detected between two Shape3Ds. */ 20 | class ColorBehavior : public Behavior { 21 | public: 22 | ColorBehavior(); 23 | ~ColorBehavior(); 24 | void onCollision(const Vertex3D & vtxWall, const Vertex3D & vtxOwn, Group * g); 25 | void onTick(); 26 | void StdOnSignal(); 27 | }; 28 | 29 | #endif // COLORBEHAVIOR_H 30 | -------------------------------------------------------------------------------- /base/PointLightVisitor.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | PointLightVisit.h - description 3 | ------------------- 4 | begin : Sun Jan 30 2000 5 | copyright : (C) 2000 by Henrik Enqvist 6 | email : henqvist@excite.com 7 | ***************************************************************************/ 8 | 9 | #ifndef POINTLIGHTVISITOR_H 10 | #define POINTLIGHTVISITOR_H 11 | 12 | #include 13 | 14 | #include "Visitor.h" 15 | #include "EMath.h" 16 | 17 | class Light; 18 | class Group; 19 | class Shape3D; 20 | 21 | /** Only for internal use. */ 22 | class PointLightVisitor : public Visitor { 23 | protected: 24 | PointLightVisitor(int size = 4); 25 | public: 26 | ~PointLightVisitor(); 27 | static PointLightVisitor * getInstance(); 28 | void add(Light* l); 29 | void visit(Group* g); 30 | void clear(); 31 | private: 32 | vector m_vLight; 33 | void visit(Shape3D* s, Group* g); 34 | static PointLightVisitor * p_PointLightVisitor; 35 | }; 36 | 37 | #endif // POINTLIGHTVISITOR_H 38 | -------------------------------------------------------------------------------- /data/professor/Makefile.am: -------------------------------------------------------------------------------- 1 | AUTOMAKE_OPTIONS = gnu 2 | 3 | highscoredir = $(DESTDIR)/$(EM_BUILD_ROOT)/$(EM_HIGHSCORE_DIR)/professor 4 | 5 | professorlibdir = $(EM_LIBDIR) 6 | professordatadir = $(datadir)/pinball/professor 7 | 8 | professorlib_LTLIBRARIES = libModuleProfessor.la 9 | 10 | AM_CPPFLAGS = -I../../base -I.../../addon -I../../src 11 | 12 | libModuleProfessor_la_LDFLAGS = -module 13 | libModuleProfessor_la_SOURCES = ModuleProfessor.cpp 14 | 15 | professordata_DATA = \ 16 | bump.wav \ 17 | bumphard.wav \ 18 | bumpsoft.wav \ 19 | flip.wav \ 20 | floor.png \ 21 | floor.png.pcx \ 22 | gameover.wav \ 23 | introp.ogg \ 24 | nudge.wav \ 25 | pinball.pbl \ 26 | professor.ogg \ 27 | professor.png 28 | 29 | # This will create a new empty highscores file 30 | # NOTE! The user games must exist! 31 | install-data-hook: 32 | -mkdir -p $(highscoredir) # - if not root #!rzr 33 | -touch $(highscoredir)/highscores 34 | -if test `whoami` = root; then chown games $(highscoredir)/highscores; fi 35 | -if test `whoami` = root; then chgrp games $(highscoredir)/highscores; fi 36 | -chmod 666 $(highscoredir)/highscores 37 | 38 | EXTRA_DIST = $(professordata_DATA) 39 | -------------------------------------------------------------------------------- /base/Light.cpp: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | Light.cpp - description 3 | ------------------- 4 | begin : Sun Jan 30 2000 5 | copyright : (C) 2000 by 6 | email : 7 | ***************************************************************************/ 8 | 9 | #include 10 | 11 | #include "Private.h" 12 | #include "Light.h" 13 | 14 | Light::Light(float c, float l, float q, float r, float g, float b) { 15 | m_bOn = true; 16 | p_Parent = NULL; 17 | m_fConstant = EM_MAX(c, 0.0); 18 | m_fLinear = EM_MAX(l, 0.0); 19 | m_fQuadratic = EM_MAX(q, 0.0); 20 | m_fBounds = 1.0; 21 | m_iProperties = EM_USE_DIFFUSE + EM_USE_SPECULAR; 22 | m_fR = EM_MAX(EM_MIN(1.0, r), 0.0); 23 | m_fG = EM_MAX(EM_MIN(1.0, g), 0.0); 24 | m_fB = EM_MAX(EM_MIN(1.0, b), 0.0); 25 | m_vtxSrc.x = 0; 26 | m_vtxSrc.y = 0; 27 | m_vtxSrc.z = 0; 28 | } 29 | 30 | Light::~Light() { 31 | } 32 | 33 | void Light::setProperty(int p) { 34 | m_iProperties |= p; 35 | } 36 | 37 | void Light::unsetProperty(int p) { 38 | m_iProperties -= (m_iProperties & p); 39 | } 40 | -------------------------------------------------------------------------------- /src/BallGroup.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | BallGroup.h - description 3 | ------------------- 4 | begin : Sat Mar 8 2003 5 | copyright : (C) 2000 by Henrik Enqvist 6 | email : henqvist@excite.com 7 | ***************************************************************************/ 8 | 9 | #ifndef BALLGROUP_H 10 | #define BALLGROUP_H 11 | 12 | #include "Group.h" 13 | #include "EMath.h" 14 | 15 | class Engine; 16 | class Group; 17 | class Shape3D; 18 | 19 | /** */ 20 | class BallGroup : public Group { 21 | public: 22 | BallGroup(float r, float g, float b, int pbl); 23 | ~BallGroup(); 24 | /** -1 always, 0 off, >1 timer */ 25 | inline void setFireTimer(int timer) { 26 | m_iFireTimer = timer; 27 | }; 28 | void updateFire(); 29 | void resetFire(); 30 | void tick(); 31 | inline int getBall() { return m_iBall; }; 32 | private: 33 | int m_iBall; 34 | int m_iFireTimer; 35 | Vertex3D vtxPrev; 36 | Group * aFire[8]; 37 | Shape3D * aFireShape[8]; 38 | Vertex3D aFireVtx[16]; 39 | }; 40 | 41 | #endif // BALLGROUP_H 42 | -------------------------------------------------------------------------------- /extra/profile/pincab/etc/pinball/weston.ini: -------------------------------------------------------------------------------- 1 | # file:///etc/xdg/weston/weston.ini 2 | # SPDX-FileCopyrightText: 2021 Philippe Coval 3 | # SPDX-License-Identifier: GPL-2.0+" 4 | 5 | [core] 6 | idle-time=0 7 | require-input=false 8 | xwayland=false 9 | 10 | [shell] 11 | panel-position=none 12 | locking=false 13 | background-color=0xff002244 14 | background-image=/usr/share/games/pinball/splash.png 15 | 16 | [libinput] 17 | enable_tap=false 18 | 19 | [input-method] 20 | path= 21 | 22 | [output] 23 | name=DP-1 24 | # mode=off 25 | mode=1024x768 26 | transform=rotate-90 27 | 28 | [output] 29 | name=DP-2 30 | mode=off 31 | # mode=1024x768 32 | transform=rotate-90 33 | 34 | [output] 35 | name=DVI-I-1 36 | mode=off 37 | # mode=1024x768 38 | transform=rotate-90 39 | 40 | # configure: playfield screen on PI 41 | [output] 42 | name=HDMI-A-1 43 | # mode=off 44 | mode=1024x768 45 | transform=rotate-90 46 | 47 | [output] 48 | name=LVDS-1 49 | mode=off 50 | # mode=1024x768 51 | transform=rotate-90 52 | 53 | [output] 54 | name=Virtual-1 55 | # mode=off 56 | mode=1024x768 57 | transform=rotate-90 58 | 59 | [output] 60 | name=VGA-1 61 | mode=off 62 | # mode=1024x768 63 | transform=rotate-90 64 | -------------------------------------------------------------------------------- /src/BumperBehavior.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | BumperBehavior.h - description 3 | ------------------- 4 | begin : Thu Mar 9 2000 5 | copyright : (C) 2000 by 6 | email : 7 | ***************************************************************************/ 8 | 9 | #ifndef BUMPERBEHAVIOR_E 10 | #define BUMPERBEHAVIOR_E 11 | 12 | #include "Behavior.h" 13 | #include "EMath.h" 14 | #include "Light.h" 15 | #include "StateMachine.h" 16 | 17 | /** A behavior for the pinball game. */ 18 | class BumperBehavior : public Behavior { 19 | public: 20 | BumperBehavior(); 21 | ~BumperBehavior(); 22 | void onTick(); 23 | void StdOnSignal(); 24 | void StdOnCollision(); 25 | inline void setPower(float p) { m_fPower = p; }; 26 | inline float getPower() { return m_fPower; }; 27 | inline void setSound(int s) { m_iSound = s; }; 28 | inline int getSound() { return m_iSound; }; 29 | private: 30 | int m_sigBump; 31 | int m_iLightCounter; 32 | int m_iSound; 33 | float m_fPower; 34 | bool m_bTilt; 35 | }; 36 | 37 | #endif // BounceBehavior 38 | -------------------------------------------------------------------------------- /addon/KeyRotBehavior.cpp: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | KeyRorBehavior.cpp - description 3 | ------------------- 4 | begin : Wed Jan 26 2000 5 | copyright : (C) 2000 by Henrik Enqvist 6 | email : henqvist@excite.com 7 | ***************************************************************************/ 8 | 9 | #include "Private.h" 10 | #include "KeyRotBehavior.h" 11 | #include "Group.h" 12 | #include "Keyboard.h" 13 | 14 | KeyRotBehavior::KeyRotBehavior() : Behavior() { 15 | } 16 | 17 | KeyRotBehavior::~KeyRotBehavior() { 18 | } 19 | 20 | void KeyRotBehavior::onTick() { 21 | EmAssert(this->getParent() != NULL, "KeyRotBehavior::onTick parent NULL"); 22 | float x = 0, y = 0, z = 0; 23 | if (Keyboard::isKeyDown(SDLK_RIGHT)) y = 0.01f; 24 | if (Keyboard::isKeyDown(SDLK_LEFT)) y = -0.01f; 25 | if (Keyboard::isKeyDown(SDLK_UP)) x = 0.01f; 26 | if (Keyboard::isKeyDown(SDLK_DOWN)) x = -0.01f; 27 | if (Keyboard::isKeyDown(SDLK_PAGEUP)) z = 0.01f; 28 | if (Keyboard::isKeyDown(SDLK_PAGEDOWN)) z = -0.01f; 29 | this->getParent()->addRotation(x, y, z); 30 | } 31 | -------------------------------------------------------------------------------- /extra/profile/pinball/etc/pinball/pinball.env.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | # SPDX-License-Identifier: GPL-2.0+ 3 | 4 | PINBALL_PROFILE="pinball" 5 | 6 | # Output screen 7 | # PINBALL_SCREEN="DP-1" 8 | 9 | # TODO: Use preferred resolution (align to /etc/default/pinball) 10 | # PINBALL_RESOLUTION="1024x768" 11 | 12 | # TODO 13 | PINBALL_EXTRA_DIR="/usr/local/opt/pinball" 14 | 15 | PINBALL_IMAGE="/usr/local/opt/pinball/src/pinball/tmp/1024x1024/pinball.jpg" 16 | 17 | # Random table if defined 18 | PINBALL_TABLE= 19 | 20 | # Quit after displayed frames (for developers) 21 | # PINBALL_QUIT=4294967295 22 | # export PINBALL_QUIT 23 | 24 | # Readonly FS 25 | HOME="/tmp/pinball" 26 | 27 | # Graphical system : weston or xinit 28 | PINBALL_DISPLAY_MANAGER='weston' 29 | XDG_RUNTIME_DIR='/run/user/0' 30 | #PINBALL_DISPLAY_MANAGER="xinit" 31 | #DISPLAY=':0' 32 | #XINITRC="/etc/pinball/pinball-session.sh" 33 | #PINBALL_XRANDR_ARGS="--rotate left --mode ${PINBALL_RESOLUTION}" 34 | 35 | DBUS_SESSION_BUS_ADDRESS='unix:path=/run/user/0/dbus/user_bus_socket' 36 | # ALSA_CARD="" 37 | 38 | # Extra 39 | # SDL_VIDEODRIVER=dummy 40 | # SDL_NOMOUSE= 41 | # SDL_AUDIODRIVER=dummy 42 | # SDL_DEBUG= 43 | 44 | # XINIT_ARGS= -- -nocursor 45 | -------------------------------------------------------------------------------- /BUILD.md: -------------------------------------------------------------------------------- 1 | ## Installing and building 2 | 3 | It is best to remove any previous version of pinball before installing a new 4 | version. If you have used a rpm-package write as root user 'rpm -e pinball'. 5 | If you have installed from source code goto the pinball source directory and 6 | write as root user 'make uninstall'. 7 | 8 | _NOTE:_ A user and group named 'games' must exist before installation, this 9 | user and group exist by defualt on most systems else: 10 | useradd 'games' (as root user) 11 | 12 | After checking that you have the necessary libraries (SDL, SDL_IMAGE and 13 | SDL_MIXER) installed you are ready to install. If you have an rpm-package 14 | you write as root user 'rpm -i pinball-x.x.x.rpm'. 15 | 16 | If you compile from a source package check that you also have the have the 17 | development libraries installed. They usually have a name like 18 | sdl-devel.x.x.x.rpm. Then install with the usual: 19 | 20 | Did you remember to install the development packages of SDL? Did you remember 21 | to install also SDL_Image and SDL_Mixer? 22 | 23 | configure 24 | make 25 | make install (as root user) 26 | make clean (if you want to save some disc space) 27 | 28 | The game is started with 'pinball'. 29 | -------------------------------------------------------------------------------- /src/FakeModuleBehavior.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | FakeModuleBehavior.h - description 3 | ------------------- 4 | begin : Wed Jan 26 2000 5 | copyright : (C) 2000 by Henrik Enqvist 6 | email : henqvist@excite.com 7 | ***************************************************************************/ 8 | 9 | #ifndef FAKEMODULEBEHAVIOR_H 10 | #define FAKEMODULEBEHAVIOR_H 11 | 12 | #include 13 | #include "Behavior.h" 14 | #include "Pinball.h" 15 | 16 | class FakeModuleBehavior : public Behavior { 17 | public: 18 | FakeModuleBehavior(const char * name) { 19 | strncpy(m_Name, name, 255); 20 | this->setType(PBL_TYPE_FAKEMODULEBEH); 21 | }; 22 | ~FakeModuleBehavior() {}; 23 | const char * getName() { 24 | return m_Name; 25 | } 26 | void setName(const char * name) { 27 | strncpy(m_Name, name, 255); 28 | } 29 | void onTick() {}; 30 | void onCollision(const Vertex3D &, const Vertex3D &, Group *) {}; 31 | void onSignal(int, Group *) {}; 32 | private: 33 | char m_Name[256]; 34 | }; 35 | 36 | #endif // KEYBEHAVIOR_H 37 | -------------------------------------------------------------------------------- /docs/Makefile: -------------------------------------------------------------------------------- 1 | #!/usr/bin/make -f 2 | # -*- makefile -*- 3 | # ex: set tabstop=4 noexpandtab: 4 | # -*- coding: utf-8 -* 5 | # 6 | # SPDX-License-Identifier: GPL-2.0-or-later 7 | # Copyright: Philippe Coval - 2021+ 8 | # 9 | 10 | default: help 11 | 12 | sudo?=sudo 13 | srcs?=$(wildcard *.md | sort) 14 | home?=Home.md 15 | branch?=$(shell git rev-parse --abbrev-ref HEAD) 16 | url?=http://localhost:4567 17 | 18 | help: 19 | @echo "Usage:" 20 | @echo "make setup start" 21 | 22 | setup/debian: /etc/debian_version 23 | ${sudo} apt-get -y update 24 | ${sudo} apt-get -y install libicu-dev cmake ruby-dev 25 | ${sudo} gem install github-linguist 26 | ${sudo} gem install gollum 27 | ${sudo} gem install org-ruby # optional 28 | 29 | setup: setup/debian 30 | -@sync 31 | 32 | run: ${home} 33 | cd ../docs/.. \ 34 | && gollum --ref ${branch} --page-file-dir docs 35 | 36 | ${home}: ${srcs} 37 | echo $^ | tr ' ' '\n' | while read file; do echo "- [$$file]($$file)" ; done > $@ 38 | -git add "$@" 39 | -git commit -sm 'docs: Regenerated default file' "$@" 40 | 41 | home: ${home} 42 | cat $< 43 | 44 | regen: 45 | rm -f ${home} 46 | make home 47 | start: 48 | x-www-browser "${url}" 49 | ${MAKE} run 50 | echo "info: Reload ${url}" 51 | -------------------------------------------------------------------------------- /extra/debos/machine/generic/actions.yaml: -------------------------------------------------------------------------------- 1 | {{- $architecture := or .architecture "i386" -}} 2 | {{- $machine := or .machine "generic" -}} 3 | {{- $project := or .project "pinball" -}} 4 | {{- $suite := or .suite "bullseye" -}} 5 | {{- $image := or .image (printf "%s-%s-%s.img" $project $architecture $machine) -}} 6 | 7 | architecture: {{$architecture}} 8 | 9 | actions: 10 | 11 | - action: image-partition 12 | imagename: {{$image}} 13 | imagesize: 2GB 14 | partitiontype: msdos 15 | mountpoints: 16 | - mountpoint: / 17 | partition: root 18 | partitions: 19 | - name: root 20 | fs: ext4 21 | start: 512 22 | end: 100% 23 | flags: [boot] 24 | 25 | - action: apt 26 | packages: 27 | {{if eq $architecture "i386" "amd64"}} 28 | - grub-pc 29 | {{end}} 30 | {{if eq $suite "unstable" "sid" "testing" "bullseye"}} 31 | - linux-image-generic 32 | {{else}} 33 | {{if eq $suite "buster" "stable"}} 34 | {{if eq $architecture "i386"}} 35 | - linux-image-686 36 | {{else}} 37 | - linux-image-{{$architecture}} 38 | {{end}} 39 | {{end}} 40 | {{end}} 41 | - firmware-linux-free 42 | - firmware-linux-nonfree 43 | 44 | -------------------------------------------------------------------------------- /extra/fink/pinball.info: -------------------------------------------------------------------------------- 1 | Package: pinball 2 | Version: 0.3.1 3 | Revision: 1002 4 | Depends: libjpeg-shlibs (>= 6b-17), libogg-shlibs (>= 1.1.4-1), libpng3-shlibs (>= 1:1.2.35-2), libtiff-shlibs (>= 3.8.2-1002), libvorbis0-shlibs (>= 1.2.3-1), sdl-image-shlibs (>= 1.2.6-1002), sdl-mixer-shlibs (>= 1.2.8-13), sdl-shlibs (>= 1.2.13-svn4819-1), smpeg-shlibs (>= 0.4.4-1027) 5 | BuildDepends: libjpeg (>= 6b-17), libogg (>= 1.1.4-1), libpng3 (>= 1:1.2.35-2), libtiff (>= 3.8.2-1002), libvorbis0 (>= 1.2.3-1), sdl-image (>= 1.2.6-1002), sdl-mixer (>= 1.2.8-13), sdl (>= 1.2.13-svn4819-1), smpeg (>= 0.4.4-1027), x11-dev 6 | Source: http://archive.ubuntu.com/ubuntu/pool/universe/p/%n/%n_%v.orig.tar.gz 7 | Source-MD5: f28e8f49e0db8e9491e4d9f0c13c36c6 8 | SourceDirectory: %n-%v 9 | SetCPPFLAGS: -I/usr/X11R6/include 10 | SetLDFLAGS: -framework OpenGL 11 | PatchScript: perl -pi -e 's,\#include "config-rzr.h",,' base/Private.h 12 | ConfigureParams: --mandir=%p/share/man --disable-dependency-tracking --disable-sdltest 13 | InstallScript: make install DESTDIR=%d 14 | DocFiles: AUTHORS COPYING ChangeLog NEWS README 15 | License: GPL 16 | GCC: 4.0 17 | Homepage: http://pinball.sourceforge.net 18 | Maintainer: Jack Fink 19 | Description: Pinball simulator 20 | 21 | -------------------------------------------------------------------------------- /extra/profile/pincab/etc/pinball/pinball.env.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | # SPDX-License-Identifier: GPL-2.0+ 3 | 4 | PINBALL_PROFILE="pincab" 5 | 6 | # TODO: pin version 7 | PINBALL_BRANCH="next" 8 | 9 | # Output screen 10 | # PINBALL_SCREEN="DVI-I-1" 11 | 12 | # TODO: Use preferred resolution (align to /etc/default/pinball) 13 | PINBALL_RESOLUTION="1024x768" 14 | 15 | # TODO 16 | PINBALL_EXTRA_DIR="/usr/local/opt/pinball" 17 | 18 | PINBALL_IMAGE="/usr/local/opt/pinball/src/pinball/tmp/1024x1024/pinball.jpg" 19 | 20 | # Random table if defined 21 | PINBALL_TABLE= 22 | 23 | # Quit after displayed frames (for developers) 24 | # PINBALL_QUIT=4294967295 25 | # export PINBALL_QUIT 26 | 27 | # Readonly FS 28 | HOME="/tmp/${PINBALL_PROFILE}" 29 | 30 | # Graphical system : weston or xinit 31 | PINBALL_DISPLAY_MANAGER='weston' 32 | XDG_RUNTIME_DIR='/run/user/0' 33 | #PINBALL_DISPLAY_MANAGER="xinit" 34 | #DISPLAY=':0' 35 | #XINITRC="/etc/pinball/pinball-session.sh" 36 | #PINBALL_XRANDR_ARGS="--rotate left --mode ${PINBALL_RESOLUTION}" 37 | 38 | DBUS_SESSION_BUS_ADDRESS='unix:path=/run/user/0/dbus/user_bus_socket' 39 | # ALSA_CARD="" 40 | 41 | # Extra 42 | # SDL_VIDEODRIVER=dummy 43 | # SDL_NOMOUSE= 44 | # SDL_AUDIODRIVER=dummy 45 | # SDL_DEBUG= 46 | 47 | # XINIT_ARGS= -- -nocursor 48 | -------------------------------------------------------------------------------- /debian/pinball-config.6: -------------------------------------------------------------------------------- 1 | .TH "PINBALL-CONFIG" "6" 2 | .SH "NAME" 3 | pinball-config \- returns information about installed pinball libraries and 4 | binaries 5 | .SH SYNOPSIS 6 | .B pinball-config 7 | [OPTIONS] 8 | .SH DESCRIPTION 9 | The 10 | .B pinball-config 11 | shell script is designed to retrieve the configuration information about 12 | the libraries and binaries of the 13 | .B pinball 14 | package. 15 | .SH "OPTIONS" 16 | .TP 17 | \fB\-\-version\fR 18 | displays the pinball version number 19 | .TP 20 | \fB\-\-libs\fR 21 | lists libraries needed for building new levels 22 | .TP 23 | \fB\-\-cflags\fR 24 | lists additional compilation flags needed 25 | .TP 26 | \fB\-\-datadir\fR 27 | Display the installation datadir 28 | .TP 29 | \fB\-\-libdir\fR 30 | Display the installation libdir 31 | .TP 32 | \fB\-\-prefix\fR 33 | Display the installation prefix 34 | .TP 35 | \fB\-\-exec\-prefix\fR 36 | Display the installation exec-prefix 37 | .SH "SEE ALSO" 38 | .PP 39 | The program is documented fully by the 40 | .B README 41 | file that can be found under 42 | .B /usr/share/doc/pinball/README 43 | on 44 | .B Debian GNU/Linux. 45 | .SH "AUTHOR" 46 | .PP 47 | This manual page was written by Jochen Friedrich for 48 | the 49 | .B Debian GNU/Linux 50 | system (but may be used by others). 51 | -------------------------------------------------------------------------------- /base/OctTree.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | OctTree.h - description 3 | ------------------- 4 | begin : Sun Mar 19 2000 5 | copyright : (C) 2000 by Henrik Enqvist 6 | email : henqvist@excite.com 7 | ***************************************************************************/ 8 | 9 | #ifndef OCTTREE_H 10 | #define OCTTREE_H 11 | 12 | using namespace std; 13 | 14 | #include 15 | 16 | #include "EMath.h" 17 | #include "Node.h" 18 | 19 | class Group; 20 | class CollisionBounds; 21 | 22 | /** An global octtree used for speeding up collision detection and 23 | * hidden surface test. */ 24 | class OctTree { 25 | public: 26 | OctTree(int level, float size, float x=0.0f, float y=0.0f, float z=0.0f); 27 | ~OctTree(); 28 | 29 | private: 30 | friend class CollisionVisitor; 31 | 32 | void split(int depth); 33 | bool surround(CollisionBounds * cb); 34 | bool collide(CollisionBounds * cb); 35 | bool insertGroup(Group * g); 36 | void clear(); 37 | void printTree(int depth=0); 38 | 39 | float m_fSize; 40 | Vertex3D m_vtx; 41 | vector m_vOctTree; 42 | vector m_vGroup; 43 | }; 44 | 45 | #endif // OCTTREE_H 46 | -------------------------------------------------------------------------------- /src/ArmBehavior.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | ArmBehavior.h - description 3 | ------------------- 4 | begin : Wed Jan 26 2000 5 | copyright : (C) 2000 by 6 | email : 7 | ***************************************************************************/ 8 | 9 | #ifndef ARMBEHAVIOR_H 10 | #define ARMBEHAVIOR_H 11 | 12 | #include 13 | 14 | #include "Behavior.h" 15 | #include "StateMachine.h" 16 | #include "EMath.h" 17 | #include "Keyboard.h" 18 | 19 | /** A Behavior for the pinball demo. */ 20 | class ArmBehavior : public Behavior { 21 | public: 22 | ArmBehavior(bool right = true); 23 | ~ArmBehavior(); 24 | void onTick(); 25 | void StdOnSignal(); 26 | void StdEmptyOnCollision() {}; 27 | void doArm(EMKey key); 28 | inline void setSound(int s) { m_iSound = s; }; 29 | inline int getSound() { return m_iSound; }; 30 | inline void setIsRight(bool r) { m_bRight = r; }; 31 | inline bool getIsRight() { return m_bRight; }; 32 | private: 33 | Vertex3D m_vtxRot; 34 | bool m_bRight; 35 | int m_iCount; 36 | bool m_bOn; 37 | int m_iSound; 38 | bool m_bFirst; 39 | bool m_bTilt; 40 | }; 41 | 42 | #endif // ARMBEHAVIOR_H 43 | -------------------------------------------------------------------------------- /src/PlungerBehavior.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | PlungerBehavior.h - description 3 | ------------------- 4 | begin : Wed Jan 26 2000 5 | copyright : (C) 2000 by 6 | email : 7 | ***************************************************************************/ 8 | 9 | #ifndef PLUNGERBEHAVIOR_H 10 | #define PLUNGERBEHAVIOR_H 11 | 12 | #include "Behavior.h" 13 | #include "StateMachine.h" 14 | #include "EMath.h" 15 | 16 | /** A plunger, the . */ 17 | class PlungerBehavior : public Behavior { 18 | public: 19 | PlungerBehavior(); 20 | ~PlungerBehavior(); 21 | void onTick(); 22 | void StdOnSignal() {}; 23 | void StdOnCollision(); 24 | inline void setSound(int s) { m_iSound = s; }; 25 | inline int getSound() { return m_iSound; }; 26 | /** zero power is 0.0f max power is 1.0f */ 27 | inline float getPower() { return m_fPower; }; 28 | inline bool getLaunch() { return m_iLaunchState == 2; }; 29 | private: 30 | int m_iLaunchState; 31 | float m_fPower; 32 | int m_iCounter; 33 | int m_sigPlunger; 34 | int m_iSound; 35 | bool m_bFirst; 36 | Vertex3D m_vtxTr; 37 | 38 | bool m_bDoublePress; 39 | }; 40 | 41 | #endif // ARMBEHAVIOR_H 42 | -------------------------------------------------------------------------------- /base/AmbientLightVisitor.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | AmbientLightVisitor.h - description 3 | ------------------- 4 | begin : Sun Jan 30 2000 5 | copyright : (C) 2000 by Henrik Enqvist 6 | email : henqvist@excite.com 7 | ***************************************************************************/ 8 | 9 | #ifndef AMBIENTLIGHTVISITOR_H 10 | #define AMBIENTLIGHTVISITOR_H 11 | 12 | #include 13 | 14 | #include "Visitor.h" 15 | #include "EMath.h" 16 | 17 | class Light; 18 | class Group; 19 | class Shape3D; 20 | 21 | /** Only for internal use. */ 22 | class AmbientLightVisitor : public Visitor { 23 | protected: 24 | AmbientLightVisitor(int size = 4); 25 | public: 26 | ~AmbientLightVisitor(); 27 | static AmbientLightVisitor * getInstance(); 28 | void setLightning(float s, float bg); 29 | void add(Light* l); 30 | void visit(Group* g); 31 | void clear(); 32 | private: 33 | void visitAmbient(Shape3D* s); 34 | void visitPoint(Shape3D* s); 35 | 36 | vector m_vLight; 37 | float m_fStrength; 38 | float m_fBackground; 39 | static AmbientLightVisitor * p_AmbientLightVisitor; 40 | }; 41 | 42 | #endif // AMBIENTLIGHTVISITOR_H 43 | -------------------------------------------------------------------------------- /data/tux/Makefile.am: -------------------------------------------------------------------------------- 1 | #$Id: Makefile.am,v 1.13 2010/02/17 13:22:08 rzr Exp $ 2 | AUTOMAKE_OPTIONS = gnu 3 | 4 | highscoredir = $(DESTDIR)/$(EM_BUILD_ROOT)/$(EM_HIGHSCORE_DIR)/tux 5 | 6 | tuxlibdir = $(EM_LIBDIR) 7 | tuxdatadir = $(datadir)/pinball/tux 8 | 9 | tuxlib_LTLIBRARIES = libModuleTux.la 10 | AM_CPPFLAGS = -I../../base -I.../../addon -I../../src 11 | 12 | libModuleTux_la_LDFLAGS = -module 13 | libModuleTux_la_SOURCES = ModuleTux.cpp 14 | 15 | tuxdata_DATA = \ 16 | bumphard.wav \ 17 | bumpsoft.wav \ 18 | bump.wav \ 19 | face2.png \ 20 | face.png.pcx \ 21 | flip.wav \ 22 | floor2.png \ 23 | floor2.png.pcx \ 24 | floor3.png \ 25 | game.ogg \ 26 | gameover.wav \ 27 | lock.wav \ 28 | loop.wav \ 29 | floor.pbl \ 30 | intro.ogg \ 31 | multiball.ogg \ 32 | nudge.wav \ 33 | opentux.wav \ 34 | pinball.pbl \ 35 | shoot.wav \ 36 | tiles.png \ 37 | tiles.png.pcx \ 38 | up.wav 39 | 40 | # This will create a new empty highscores file 41 | # NOTE! The user games must exist! 42 | install-data-hook: 43 | -mkdir -p $(highscoredir) # - if not root #!rzr 44 | -touch $(highscoredir)/highscores 45 | -if test `whoami` = root; then chown games $(highscoredir)/highscores; fi 46 | -if test `whoami` = root; then chgrp games $(highscoredir)/highscores; fi 47 | -chmod 666 $(highscoredir)/highscores 48 | 49 | EXTRA_DIST = $(tuxdata_DATA) 50 | -------------------------------------------------------------------------------- /base/Sound.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | Sound.h - description 3 | ------------------- 4 | begin : Wed Jan 26 2000 5 | copyright : (C) 2000 by Henrik Enqvist 6 | email : henqvist@excite.com 7 | ***************************************************************************/ 8 | 9 | #ifndef SOUND_H 10 | #define SOUND_H 11 | 12 | #include "EMath.h" 13 | #include "SoundUtil.h" 14 | 15 | class Group; 16 | 17 | /** 3D Sound objects. */ 18 | class Sound { 19 | public: 20 | /** Sound( sample, distance ). Creates a sound object using the sample. 21 | * The distance parameter defines the distance were sound is played at full volume. 22 | * Create the sample using Allogros functions. */ 23 | Sound(EmSample* sample, float dist, bool b3D = true); 24 | ~Sound(){}; 25 | void play(bool loop = true); 26 | void adjust(); 27 | /** Group uses this mehtod when the Sound is added to the Group. */ 28 | void setParent(Group* g); 29 | private: 30 | Vertex3D m_vtxSrc; 31 | Vertex3D m_vtxTrans; 32 | Vertex3D m_vtxAlign; 33 | EmSample* p_Sample; 34 | bool m_bLoop; 35 | float m_fDistance; 36 | Group* p_Parent; 37 | bool m_b3D; 38 | }; 39 | 40 | #endif // SOUND_H 41 | -------------------------------------------------------------------------------- /addon/KeyBehavior.cpp: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | KeyBeh.cpp - description 3 | ------------------- 4 | begin : Wed Jan 26 2000 5 | copyright : (C) 2000 by Henrik Enqvist 6 | email : henqvist@excite.com 7 | ***************************************************************************/ 8 | 9 | #include "Private.h" 10 | #include "KeyBehavior.h" 11 | #include "Group.h" 12 | #include "Shape3D.h" 13 | #include "Keyboard.h" 14 | 15 | KeyBehavior::KeyBehavior() : Behavior() { 16 | m_x = 0; 17 | m_y = 0; 18 | m_z = 0; 19 | } 20 | 21 | KeyBehavior::~KeyBehavior() { 22 | } 23 | 24 | void KeyBehavior::onTick() { 25 | EmAssert(this->getParent() != NULL, "KeyBehavior::onTick parent NULL"); 26 | m_x = this->getParent()->m_mtxSrc.t[0]; 27 | m_y = this->getParent()->m_mtxSrc.t[1]; 28 | m_z = this->getParent()->m_mtxSrc.t[2]; 29 | if (Keyboard::isKeyDown(SDLK_a)) m_x -= 0.2; 30 | if (Keyboard::isKeyDown(SDLK_d)) m_x += 0.2; 31 | if (Keyboard::isKeyDown(SDLK_w)) m_z -= 0.2; 32 | if (Keyboard::isKeyDown(SDLK_s)) m_z += 0.2; 33 | if (Keyboard::isKeyDown(SDLK_q)) m_y -= 0.2; 34 | if (Keyboard::isKeyDown(SDLK_e)) m_y += 0.2; 35 | this->getParent()->setTranslation(m_x, m_y, m_z); 36 | } 37 | -------------------------------------------------------------------------------- /test/Makefile.am: -------------------------------------------------------------------------------- 1 | AUTOMAKE_OPTIONS = gnu 2 | 3 | testlibdir = $(EM_LIBDIR) 4 | testdatadir = $(pkgdatadir) 5 | 6 | noinst_PROGRAMS = scale simple light texture load explode collision signal billboard font thread menu joy sound trans math misc varray unittest 7 | # noinst_PROGRAMS = unittest 8 | 9 | AM_CPPFLAGS = -I../base -I../addon -I../src @INCLTDL@ 10 | LDADD = ../src/libemilia_pin.a ../addon/libemilia_addon.a ../base/libemilia_base.a @LIBLTDL@ 11 | 12 | testlib_LTLIBRARIES = libModuleTest.la 13 | 14 | libModuleTest_la_LDFLAGS = -module 15 | libModuleTest_la_SOURCES = moduletest.cpp 16 | 17 | unittest_LDFLAGS = -export-dynamic 18 | load_LDFLAGS = -export-dynamic 19 | 20 | billboard_SOURCES = billboard.cpp 21 | collision_SOURCES = collision.cpp 22 | explode_SOURCES = explode.cpp 23 | font_SOURCES = font.cpp 24 | joy_SOURCES = joy.cpp 25 | light_SOURCES = light.cpp 26 | load_SOURCES = load.cpp 27 | math_SOURCES = math.cpp 28 | menu_SOURCES = menu.cpp 29 | misc_SOURCES = misc.cpp 30 | scale_SOURCES = scale.cpp 31 | signal_SOURCES = signal.cpp 32 | simple_SOURCES = simple.cpp 33 | sound_SOURCES = sound.cpp 34 | texture_SOURCES = texture.cpp 35 | thread_SOURCES = thread.cpp 36 | trans_SOURCES = trans.cpp 37 | unittest_SOURCES = unittest.cpp 38 | varray_SOURCES = varray.cpp 39 | 40 | EXTRA_DIST = \ 41 | module.txt \ 42 | script.txt \ 43 | token.txt 44 | -------------------------------------------------------------------------------- /addon/Grid.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | Grid.h - description 3 | ------------------- 4 | begin : Tue Feb 8 2000 5 | copyright : (C) 2000 by Henrik Enqvist 6 | email : henqvist@excite.com 7 | ***************************************************************************/ 8 | 9 | #ifndef GRID_H 10 | #define GRID_H 11 | 12 | #include "Shape3D.h" 13 | 14 | /** A simple grid. @see Shape3D */ 15 | class Grid : public Shape3D { 16 | public: 17 | /** 18 | *

Grid(Texture, SizeForEachStepX, SizeForEachStepY, Steps, SizeForEachBitmapStep, 19 | * r, g, b, a)

20 | *
21 | 	   *
22 | 	   *  v-sizex-v            Steps=3
23 | 	   *  ----------------------
24 | 	   *  |      |      |      |
25 | 	   *  |      |      |      |
26 | 	   *  ---------------------- <
27 | 	   *  |      |      |      | | sizey
28 | 	   *  |      |      |      | |
29 | 	   *  ---------------------- <
30 | 	   *  |      |      |      |
31 | 	   *  |      |      |      |
32 | 	   *  ---------------------- Steps=3
33 | 	   * 
34 | */ 35 | Grid(EmTexture*, float sizex, float sizey, int steps, float bmStep, 36 | float fR=1.0, float fG=1.0, float fB=1.0, float fA=1.0); 37 | }; 38 | 39 | #endif // GRID_H 40 | -------------------------------------------------------------------------------- /pinball.dsw: -------------------------------------------------------------------------------- 1 | Microsoft Developer Studio Workspace File, Format Version 6.00 2 | # WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! 3 | 4 | ############################################################################### 5 | 6 | Project: "Base"=".\base\base.dsp" - Package Owner=<4> 7 | 8 | Package=<5> 9 | {{{ 10 | }}} 11 | 12 | Package=<4> 13 | {{{ 14 | }}} 15 | 16 | ############################################################################### 17 | 18 | Project: "Pinball"=".\src\pinball.dsp" - Package Owner=<4> 19 | 20 | Package=<5> 21 | {{{ 22 | }}} 23 | 24 | Package=<4> 25 | {{{ 26 | Begin Project Dependency 27 | Project_Dep_Name addon 28 | End Project Dependency 29 | Begin Project Dependency 30 | Project_Dep_Name Base 31 | End Project Dependency 32 | }}} 33 | 34 | ############################################################################### 35 | 36 | Project: "addon"=".\addon\addon.dsp" - Package Owner=<4> 37 | 38 | Package=<5> 39 | {{{ 40 | }}} 41 | 42 | Package=<4> 43 | {{{ 44 | }}} 45 | 46 | ############################################################################### 47 | 48 | Global: 49 | 50 | Package=<5> 51 | {{{ 52 | }}} 53 | 54 | Package=<3> 55 | {{{ 56 | }}} 57 | 58 | ############################################################################### 59 | 60 | -------------------------------------------------------------------------------- /addon/ColorBehavior.cpp: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | ColorBehavior.cpp - description 3 | ------------------- 4 | begin : Tue Feb 15 2000 5 | copyright : (C) 2000 by Henrik Enqvist 6 | email : henqvist@excite.com 7 | ***************************************************************************/ 8 | 9 | #include "Private.h" 10 | #include "ColorBehavior.h" 11 | #include "Group.h" 12 | #include "Shape3D.h" 13 | 14 | ColorBehavior::ColorBehavior() : Behavior() { 15 | } 16 | 17 | ColorBehavior::~ColorBehavior() { 18 | } 19 | 20 | void ColorBehavior::onCollision(const Vertex3D &, const Vertex3D &, Group *) { 21 | EmAssert(this->getParent() != NULL, "ColorBehavior::onCollision parent NULL"); 22 | EM_COUT("ColorBehavior::onCollision()" << endl, 0); 23 | if (this->getParent() != NULL) { 24 | for (int a=0; agetParent()->getShape3DSize(); a++) { 25 | this->getParent()->getShape3D(a)->setColor(1.0, 1.0, 0.0, 0.0); 26 | } 27 | } 28 | } 29 | 30 | void ColorBehavior::onTick() { 31 | EmAssert(this->getParent() != NULL, "ColorBehavior::onTick parent NULL"); 32 | for (int a=0; agetParent()->getShape3DSize(); a++) { 33 | this->getParent()->getShape3D(a)->setColor(1.0, 0.0, 0.0, 1.0); 34 | } 35 | } 36 | 37 | -------------------------------------------------------------------------------- /base/Profiler.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | Profiler.h - description 3 | ------------------- 4 | begin : Tue Jul 30 2001 5 | copyright : (C) 2002 by Henrik Enqvist 6 | email : henqvist@excite.com 7 | ***************************************************************************/ 8 | 9 | 10 | #ifndef PROFILER_H 11 | #define PROFILER_H 12 | 13 | 14 | #define COUNT 1 15 | #define ALIGN 2 16 | #define BEH 3 17 | #define GLIGHT 4 18 | #define COLLISION 5 19 | #define PLIGHT 6 20 | #define PNORMAL 7 21 | #define RENDER 8 22 | #define SOUND 9 23 | #define SIG 10 24 | #define TRANS 11 25 | #define DRAW 13 26 | #define SWAP 14 27 | #define KEY 15 28 | #define RENDER_OUT 16 29 | #define TICK_OUT 17 30 | #define SWAP_OUT 18 31 | #define WAIT 19 32 | 33 | 34 | /** Singleton class for quick and dirty profiling */ 35 | class Profiler { 36 | protected: 37 | Profiler(); 38 | public: 39 | ~Profiler(); 40 | static Profiler* getInstance(); 41 | void startProfile(int i); 42 | void stopProfile(); 43 | void printProfile(); 44 | private: 45 | unsigned int m_aProfile[256]; 46 | unsigned int m_iStart; 47 | unsigned int m_iCurrentProfile; 48 | unsigned int m_iCurrentTime; 49 | static Profiler* p_Profiler; 50 | }; 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | #!/bin/echo docker build . -f 2 | # -*- coding: utf-8 -*- 3 | # SPDX-License-Identifier: GPL-2.0+ 4 | 5 | FROM i386/debian:11 6 | LABEL maintainer="Philippe Coval (rzr@users.sf.net)" 7 | 8 | ENV DEBIAN_FRONTEND noninteractive 9 | ENV LC_ALL en_US.UTF-8 10 | ENV LANG ${LC_ALL} 11 | 12 | RUN echo "# log: Configuring locales" \ 13 | && set -x \ 14 | && apt-get update -y \ 15 | && apt-get install -y locales \ 16 | && echo "${LC_ALL} UTF-8" | tee /etc/locale.gen \ 17 | && locale-gen ${LC_ALL} \ 18 | && dpkg-reconfigure locales \ 19 | && sync 20 | 21 | RUN echo "# log: Setup build system" \ 22 | && set -x \ 23 | && apt-get update -y \ 24 | && apt-get install -y \ 25 | make \ 26 | sudo \ 27 | && apt-get clean \ 28 | && sync 29 | 30 | ENV project pinball 31 | ENV workdir /usr/local/opt/${project}/src/${project} 32 | 33 | ADD helper.mk ${workdir}/ 34 | WORKDIR ${workdir} 35 | RUN echo "# log: ${project}: Preparing sources" \ 36 | && set -x \ 37 | && ./helper.mk debian/setup/devel \ 38 | && sync 39 | 40 | ADD . ${workdir}/ 41 | WORKDIR ${workdir} 42 | RUN echo "# log: ${project}: Building sources" \ 43 | && set -x \ 44 | && ./helper.mk debi \ 45 | && dpkg -L ${project} \ 46 | && dpkg -L ${project}-data \ 47 | && sync 48 | 49 | RUN echo "# log: ${project}: Listing sources" \ 50 | && set -x \ 51 | && cd .. && find ${PWD}/ -maxdepth 1 \ 52 | && sync 53 | 54 | 55 | ENTRYPOINT [ "/usr/games/pinball" ] 56 | -------------------------------------------------------------------------------- /base/AlignVisitor.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | AVisitor.h - description 3 | ------------------- 4 | begin : Wed Jan 26 2000 5 | copyright : (C) 2000 by Henrik Enqvist 6 | email : henqvist@excite.com 7 | ***************************************************************************/ 8 | 9 | #ifndef ALIGNVISITOR_H 10 | #define ALIGNVISITOR_H 11 | 12 | #include "Visitor.h" 13 | #include "EMath.h" 14 | 15 | class CollisionBounds; 16 | 17 | /** Only for internal use. 18 | * AlignVisitor alignes transformed vertices to aligned vertices 19 | * by applying the camera matrix. 20 | * @see visitor */ 21 | class AlignVisitor : public Visitor { 22 | protected: 23 | AlignVisitor(); 24 | public: 25 | ~AlignVisitor(); 26 | static AlignVisitor * getInstance(); 27 | /** Applys the camera matrix to the Shape3D and Sound objects 28 | * of the group. Checks first if the objects are NULL. */ 29 | void visit(Group* g); 30 | void empty(); 31 | /** The Engine object uses this function when setting the camera marix. */ 32 | void setCamera(Group * g); 33 | private: 34 | Group* p_GroupCamera; 35 | Matrix m_mtxInverse; 36 | Vertex3D m_vtxFront; 37 | Vertex3D m_vtxUp; 38 | Vertex3D m_vtxTrans; 39 | Vertex3D m_vtxRot; 40 | static AlignVisitor * p_AlignVisitor; 41 | }; 42 | 43 | #endif // ALIGNVISITOR_H 44 | -------------------------------------------------------------------------------- /base/BillBoard.cpp: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | BillBoard.cpp - description 3 | ------------------- 4 | begin : Sun Dec 16 2001 5 | copyright : (C) 2001 by henqvist 6 | email : henqvist@excite.com 7 | ***************************************************************************/ 8 | 9 | #include "Private.h" 10 | #include "BillBoard.h" 11 | 12 | BillBoard::BillBoard(EmTexture * tex, float sizex, float sizey) { 13 | EmAssert(tex != NULL, "texture not allowed to be null"); 14 | 15 | m_iProperties = 0; 16 | p_Parent = NULL; 17 | m_Texture = tex; 18 | m_fSizexD2 = sizex / 2; 19 | m_fSizeyD2 = sizey / 2; 20 | m_fZOffset = 0; 21 | 22 | m_aTexCoord[0].u = 0; 23 | m_aTexCoord[0].v = 0; 24 | m_aTexCoord[1].u = 1; 25 | m_aTexCoord[1].v = 0; 26 | m_aTexCoord[2].u = 1; 27 | m_aTexCoord[2].v = 1; 28 | m_aTexCoord[3].u = 0; 29 | m_aTexCoord[3].v = 1; 30 | 31 | m_vtxSrc.x = 0; 32 | m_vtxSrc.y = 0; 33 | m_vtxSrc.z = 0; 34 | } 35 | 36 | BillBoard::~BillBoard() { 37 | } 38 | 39 | void BillBoard::setProperty(int p) { 40 | m_iProperties |= p; 41 | } 42 | 43 | void BillBoard::unsetProperty(int p) { 44 | m_iProperties -= (m_iProperties & p); 45 | } 46 | 47 | void BillBoard::setParent(Group* p) { 48 | p_Parent = p; 49 | } 50 | 51 | void BillBoard::setTexture(EmTexture* tex) { 52 | m_Texture = tex; 53 | } 54 | 55 | -------------------------------------------------------------------------------- /base/SignalSender.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | SignalVisitor.h - description 3 | ------------------- 4 | begin : Wed Jan 26 2000 5 | copyright : (C) 2000 by Henrik Enqvist 6 | email : henqvist@excite.com 7 | ***************************************************************************/ 8 | 9 | #ifndef SIGNALSENDER_H 10 | #define SIGNALSENDER_H 11 | 12 | #include 13 | 14 | #include "Visitor.h" 15 | 16 | class Group; 17 | 18 | typedef struct { 19 | int signal; 20 | int delay; 21 | Group * sender; 22 | Group * reciever; 23 | } SignalStruct; 24 | 25 | 26 | /** A medium for sending signals between behaviors. */ 27 | class SignalSender { 28 | protected: 29 | SignalSender(); 30 | public: 31 | ~SignalSender(); 32 | static SignalSender * getInstance(); 33 | /** If reciever is NULL the signal will be sent to all registered groups, multicast. */ 34 | void addSignal(int signal, int delay, Group * sender, Group * reciever); 35 | void addGroup(Group * g); 36 | /** Removes all groups from the signalsender. Does not not free the memory 37 | * allocated by the groups. */ 38 | void clear(); 39 | void tick(); 40 | private: 41 | vector m_vSignal; 42 | vector m_vSignalBuffer; 43 | vector m_vGroup; 44 | static SignalSender * p_SignalSender; 45 | }; 46 | #endif // SIGNALVISITOR_H 47 | -------------------------------------------------------------------------------- /base/RenderVisitor.h: -------------------------------------------------------------------------------- 1 | // -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- 2 | // SPDX-License-Identifier: GPL-2.0+ 3 | // Copyright: Henrik Enqvist and contributors 2001-present 4 | 5 | /*************************************************************************** 6 | RenderVisitor.h - description 7 | ------------------- 8 | begin : Sat Jan 6 2001 9 | copyright : (C) 2001 by Henrik Enqvist 10 | email : henqvist@excite.com 11 | ***************************************************************************/ 12 | 13 | #ifndef RENDERVISITOR_H 14 | #define RENDERVISITOR_H 15 | 16 | #include 17 | 18 | class Group; 19 | class Shape3D; 20 | 21 | #include "Visitor.h" 22 | 23 | 24 | /// Dummy renderer to be derived 25 | class RenderVisitor 26 | : public Visitor 27 | { 28 | public: 29 | static RenderVisitor* getInstance(); //< may be derived 30 | public: 31 | virtual ~RenderVisitor() {} 32 | protected: 33 | RenderVisitor() : Visitor(), m_iPoly(0) {} 34 | public: 35 | virtual void visit(Group* g) {} 36 | virtual void empty() {} 37 | virtual int getMode() { return m_iMode; }; 38 | virtual void setMode(int m) { m_iMode = m; }; 39 | virtual int getPolys() { return m_iPoly; }; 40 | private: 41 | virtual void visit(Shape3D* s, Group* g) {} 42 | protected: 43 | int m_iMode; 44 | bool m_bOffset; 45 | int m_iPoly; 46 | }; 47 | 48 | #endif // RENDERVISITOR_H 49 | 50 | -------------------------------------------------------------------------------- /pinball-config.in: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | # @configure_input@ 3 | # 4 | 5 | prefix=@prefix@ 6 | exec_prefix=@exec_prefix@ 7 | 8 | usage() 9 | { 10 | cat <&2 26 | fi 27 | 28 | while test $# -gt 0; do 29 | case $1 in 30 | --version) 31 | echo @PACKAGE_VERSION@ 32 | ;; 33 | --cflags) 34 | echo_cflags=yes 35 | ;; 36 | --libs) 37 | echo_libs=yes 38 | ;; 39 | --datadir) 40 | echo_datadir=yes 41 | ;; 42 | --libdir) 43 | echo_libdir=yes 44 | ;; 45 | --prefix) 46 | echo_prefix=yes 47 | ;; 48 | --exec-prefix) 49 | echo_execprefix=yes 50 | ;; 51 | *) 52 | usage 1 1>&2 53 | ;; 54 | esac 55 | shift 56 | done 57 | 58 | if test "$echo_cflags" = "yes"; then 59 | echo -I@includedir@/pinball/.. 60 | fi 61 | 62 | if test "$echo_libs" = "yes"; then 63 | echo -L@libdir@/pinball 64 | fi 65 | if test "$echo_datadir" = "yes"; then 66 | echo @datadir@/pinball 67 | fi 68 | if test "$echo_libdir" = "yes"; then 69 | echo @EM_LIBDIR@ 70 | fi 71 | if test "$echo_prefix" = "yes"; then 72 | echo @prefix@ 73 | fi 74 | if test "$echo_execprefix" = "yes"; then 75 | echo @execprefix@ 76 | fi 77 | -------------------------------------------------------------------------------- /base/BehaviorVisitor.cpp: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | BehaviorVisitor.cpp - description 3 | ------------------- 4 | begin : Wed Jan 26 2000 5 | copyright : (C) 2000 by Henrik Enqvist 6 | email : henqvist@excite.com 7 | ***************************************************************************/ 8 | #include "Private.h" 9 | #include "BehaviorVisitor.h" 10 | #include "Behavior.h" 11 | #include "Group.h" 12 | 13 | #include 14 | #include 15 | #include 16 | 17 | BehaviorVisitor * BehaviorVisitor::p_BehaviorVisitor = NULL; 18 | 19 | BehaviorVisitor::BehaviorVisitor() { 20 | } 21 | 22 | BehaviorVisitor::~BehaviorVisitor() { 23 | p_BehaviorVisitor = NULL; 24 | } 25 | 26 | BehaviorVisitor * BehaviorVisitor::getInstance() { 27 | if (p_BehaviorVisitor == NULL) { 28 | p_BehaviorVisitor = new BehaviorVisitor(); 29 | } 30 | return p_BehaviorVisitor; 31 | } 32 | 33 | void BehaviorVisitor::visit(Group* g) { 34 | // Check properties before applying behavior 35 | if (g->m_iProperties & EM_GROUP_NO_BEHAVIOR) return; 36 | #ifdef PINBALL_TODO 37 | vector::iterator iter = g->m_vBehavior.begin(); 38 | vector::iterator end = g->m_vBehavior.end(); 39 | for(; iter != end; iter++) { 40 | (*iter)->onTick(); 41 | } 42 | #endif 43 | if (g->getBehavior() != NULL) { 44 | g->getBehavior()->onTick(); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /FAQ.md: -------------------------------------------------------------------------------- 1 | ## FAQ 2 | 3 | **Q:** What hardware is supported 4 | **A:** 5 | * minimal 300 Mhz cpu. 6 | * 450 Mhz PIII+ preferred 7 | * Decent graphics card, voodoo3, tnt2, geforce, matrox g450 8 | (you do not need anything superfast). 9 | Graphics card known to work: Voodoo3, Matrox G450, GeForce4. 10 | 11 | **Q:** What minimal OS is supported ? 12 | 13 | **A:** Compiles without problems on: RedHat 7.3, 8.0, 9.0, Debian 3.0. 14 | 15 | **Q:** The 'boot' and 'tux' lights on the floor blinks or have vertical 16 | lines? 17 | 18 | **A:** Some buggy implementations of OpenGL does not implement the polygon 19 | offset command - which is need by the game for correct rendering. 20 | 21 | **Q:** Sounds are delayed with 0.5 seconds? 22 | 23 | **A:** You're either using arts, esd or have buggy audio drivers. Stop 24 | arts and esd, if that does not help install alsa drivers. 25 | 26 | **Q:** The rpm doesn't fit my dist and the source won't compile? 27 | Search the web for rpms, e.g. Mandrake rpms seems to pop up on 28 | rpmfind a couple of weeks/months after my releases. 29 | For compiling: double check that you the _development_ packages of OpenGL, X, SDL, 30 | SDL_image, SDL_mixer are installed. 31 | 32 | **Q:** Can I help? 33 | 34 | **A:** Yes, I would like to check that the physics model of the game is 35 | somewhat like a real pinball machine without putting all my money into 36 | the pinball games at the local game corner. So if you have a spare 37 | pinball machine send it to me (it don't think it will fit in the 38 | mail though...). 39 | -------------------------------------------------------------------------------- /src/LoaderModule.h: -------------------------------------------------------------------------------- 1 | //#ident "$Id: LoaderModule.h,v 1.2 2003/04/09 12:19:07 rzr Exp $" 2 | #ifndef LoaderModule_h_ 3 | #define LoaderModule_h_ 4 | #include 5 | #include 6 | using namespace std; 7 | class Beaviour; 8 | 9 | /// 10 | struct ltstr 11 | { 12 | bool operator()( char* const s1, char* const s2) const { 13 | return strcmp(s1, s2) < 0; 14 | } 15 | }; 16 | 17 | /** 18 | * @author: Philippe.COVAL(a)IFrance.com - www.rzr.online.fr - Rev: $Author: rzr $ 19 | * Load any beaviour from his filemane 20 | * currently those plugins are C++ classes 21 | * (build in a separate dyn lib or staticly with the main programm) 22 | * In the future it would be nice to load interpreted scripts as well 23 | * (perl, pyton etc) 24 | * Toggle dynlib off / Workaround dynlib loading bugs 25 | * (and keyboard bug that goes along on win32) 26 | **/ 27 | class LoaderModule 28 | { 29 | public: 30 | /// 31 | LoaderModule(); 32 | /// 33 | virtual ~LoaderModule(); 34 | /// 35 | static LoaderModule* getInstance(); 36 | /// 37 | Behavior* read(string & filename); 38 | /// 39 | Behavior* readLibStatic(string & filename) ; 40 | /// portable dyn lib loading 41 | Behavior* readLibDynamic(string & filename); 42 | 43 | private: 44 | void SanitizePath(std::string&str ); 45 | 46 | protected: 47 | /// 48 | map m_hMods; 49 | /// 50 | static LoaderModule * p_Instance; 51 | }; 52 | #endif //_h_ inclusion 53 | //$Id: LoaderModule.h,v 1.2 2003/04/09 12:19:07 rzr Exp $ 54 | -------------------------------------------------------------------------------- /addon/Cone.cpp: -------------------------------------------------------------------------------- 1 | //#ident "$Id: Cone.cpp,v 1.8 2003/05/12 12:17:58 rzr Exp $" 2 | /*************************************************************************** 3 | Cone.cpp - description 4 | ------------------- 5 | begin : Wed Jan 26 2000 6 | copyright : (C) 2000 by Henrik Enqvist 7 | email : henqvist@excite.com 8 | ***************************************************************************/ 9 | 10 | #include "Private.h" 11 | #include "Cone.h" 12 | #include "Polygon.h" 13 | 14 | Cone::Cone(float fSize, int sides, float fR, float fG, float fB, float fA) : Shape3D(8+1, 8+1) { 15 | if (sides < 3) sides = 3; 16 | Polygon3D* p; 17 | // Top vertex. 18 | this->add(0, fSize/2, 0); 19 | // Ring of vertices. 20 | for (float a=0; aadd( EMath::emSin(a/sides)*fSize/2, -fSize/2 , EMath::emCos(a/sides)*fSize/2, 22 | fR, fG, fB, fA, 0.0f, 0.0f); 23 | } 24 | // The ring of polygons. 25 | { for (int a=1; aadd(0); 28 | p->add(a+1); 29 | p->add(a); 30 | this->add(p); 31 | } } 32 | // the last one 33 | p = new Polygon3D(this, 3); 34 | p->add(0); 35 | p->add(1); 36 | p->add(sides); 37 | this->add(p); 38 | // The bottom of the cone. 39 | p = new Polygon3D(this, sides); 40 | { for (int a=0; aadd(a+1); 42 | } } 43 | this->add(p); 44 | 45 | this->countNormals(); 46 | } 47 | -------------------------------------------------------------------------------- /test/big.cpp: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | Simple test. A grid should be visible in the middle of the screen. 3 | The arrow keys rotates the grid. 4 | ***************************************************************************/ 5 | 6 | #include "Engine.h" 7 | #include "Camera.h" 8 | #include "Grid.h" 9 | #include "KeyRotBehavior.h" 10 | #include "Keyboard.h" 11 | 12 | /** Main */ 13 | int main(int argc, char *argv[]) { 14 | cerr << "Simple emilia test." << endl; 15 | 16 | // Create the engine. 17 | Engine* engine = new Engine(argc, argv); 18 | engine->setLightning(0.5f, 0.1f); 19 | 20 | // Add a camera. Move a bit. 21 | Camera* camera = new Camera(); 22 | Group* groupCamera = new Group(); 23 | engine->add(groupCamera); 24 | groupCamera->setCamera(camera); 25 | groupCamera->setTranslation(0, 0, 100); 26 | engine->setEngineCamera(groupCamera); 27 | // Add a grid. 28 | Grid* grid = new Grid(NULL, 100.0f, 100.0f, 50, 0.01f, 1.0f, 1.0f, 0.0f, 1.0f); 29 | Group* groupGrid = new Group(); 30 | engine->add(groupGrid); 31 | groupGrid->addShape3D(grid); 32 | groupGrid->setProperty(EM_GROUP_TRANSFORM_ONCE); 33 | 34 | // Add a behavior to the cube 35 | //KeyRotBehavior* keyRBeh = new KeyRotBehavior(); 36 | //groupGrid->setBehavior(keyRBeh); 37 | groupGrid->setTransform(0, 0, 0, -0.3f, 0.0f, 0.0f); 38 | 39 | while (!Keyboard::isKeyDown(SDLK_ESCAPE)) { 40 | engine->tick(); 41 | engine->render(); 42 | engine->swap(); 43 | } 44 | delete(engine); 45 | return 0; 46 | } 47 | -------------------------------------------------------------------------------- /base/Makefile.am: -------------------------------------------------------------------------------- 1 | AUTOMAKE_OPTIONS = gnu 2 | 3 | pinlibdir = $(libdir)/pinball 4 | pinincludedir = $(includedir)/pinball 5 | 6 | pinlib_LIBRARIES = libemilia_base.a 7 | 8 | AM_CPPFLAGS = -I../addon 9 | 10 | libemilia_base_a_SOURCES = \ 11 | AlignVisitor.cpp \ 12 | AllegroVisitor.cpp \ 13 | AmbientLightVisitor.cpp \ 14 | Behavior.cpp \ 15 | BehaviorVisitor.cpp \ 16 | BillBoard.cpp \ 17 | Camera.cpp \ 18 | CollisionBounds.cpp \ 19 | CollisionVisitor.cpp \ 20 | Config.cpp \ 21 | EMath.cpp \ 22 | EmFont.cpp \ 23 | Engine.cpp \ 24 | Group.cpp \ 25 | Keyboard.cpp \ 26 | Light.cpp \ 27 | Node.cpp \ 28 | OctTree.cpp \ 29 | OpenGLVisitor.cpp \ 30 | PointLightVisitor.cpp \ 31 | Polygon.cpp \ 32 | Profiler.cpp \ 33 | RenderVisitor.cpp \ 34 | Shape3D.cpp \ 35 | SignalSender.cpp \ 36 | Sound.cpp \ 37 | SoundUtil.cpp \ 38 | SoundVisitor.cpp \ 39 | TextureUtil.cpp \ 40 | TransformVisitor.cpp 41 | 42 | pininclude_HEADERS = \ 43 | AlignVisitor.h \ 44 | AllegroVisitor.h \ 45 | AmbientLightVisitor.h \ 46 | BaseTest.h \ 47 | Behavior.h \ 48 | BehaviorVisitor.h \ 49 | BillBoard.h \ 50 | Camera.h \ 51 | CollisionBounds.h \ 52 | CollisionVisitor.h \ 53 | Config.h \ 54 | EMath.h \ 55 | EmFont.h \ 56 | Engine.h \ 57 | Group.h \ 58 | Keyboard.h \ 59 | Light.h \ 60 | Node.h \ 61 | OctTree.h \ 62 | OpenGLVisitor.h \ 63 | PointLightVisitor.h \ 64 | Polygon.h \ 65 | Private.h \ 66 | Profiler.h \ 67 | RenderVisitor.h \ 68 | Shape3D.h \ 69 | SignalSender.h \ 70 | Sound.h \ 71 | SoundUtil.h \ 72 | SoundVisitor.h \ 73 | StateMachine.h \ 74 | TextureUtil.h \ 75 | TransformVisitor.h \ 76 | Visitor.h 77 | -------------------------------------------------------------------------------- /test/key.cpp: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | Font test. A cube should be visible in the middle of the screen. 3 | Some text applied on the screen. 4 | The arrow keys rotates the cube. 5 | ***************************************************************************/ 6 | 7 | #include "Engine.h" 8 | #include "Camera.h" 9 | #include "Cube.h" 10 | #include "KeyRotBehavior.h" 11 | #include "Keyboard.h" 12 | #include "EmFont.h" 13 | #include 14 | 15 | /** Main */ 16 | int main(int argc, char *argv[]) { 17 | cerr << "Font test." << endl; 18 | 19 | // Create the engine. 20 | Engine* engine = new Engine(argc, argv); 21 | engine->setLightning(0.5f, 0.1f); 22 | 23 | // Add a camera. Move a bit. 24 | Camera* camera = new Camera(); 25 | Group* groupCamera = new Group(); 26 | engine->add(groupCamera); 27 | groupCamera->setCamera(camera); 28 | groupCamera->setTranslation(0, 0, 3); 29 | engine->setEngineCamera(groupCamera); 30 | 31 | // Add a cube. 32 | Cube* cube = new Cube(1.0, 1,1,0,1); 33 | Group* groupCube = new Group(); 34 | engine->add(groupCube); 35 | groupCube->addShape3D(cube); 36 | 37 | // Add a behavior to the cube 38 | KeyRotBehavior* keyRBeh = new KeyRotBehavior(); 39 | groupCube->addBehavior(keyRBeh); 40 | 41 | cerr << "press any key to hop"; 42 | cerr << "any key and esc to quit"; 43 | 44 | SDLKey key = SDLK_a; 45 | while (key != SDLK_ESCAPE) { 46 | engine->tick(); 47 | engine->render(); 48 | engine->swap(); 49 | key = Keyboard::waitForKey(); 50 | } 51 | delete(engine); 52 | return 0; 53 | } 54 | -------------------------------------------------------------------------------- /test/sound.cpp: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | Simple test. A cube should be visible in the middle of the screen. 3 | The arrow keys rotates the cube. 4 | ***************************************************************************/ 5 | 6 | #include 7 | 8 | #include "Private.h" 9 | #include "Engine.h" 10 | #include "Camera.h" 11 | #include "Cube.h" 12 | #include "KeyRotBehavior.h" 13 | #include "Keyboard.h" 14 | #include "SoundUtil.h" 15 | 16 | /** Main */ 17 | int main(int argc, char *argv[]) { 18 | cerr << "Sound test." << endl; 19 | 20 | if (argc < 3) { 21 | cerr << "Usage: sound " << endl; 22 | return -1; 23 | } 24 | // Create the engine. 25 | Engine* engine = new Engine(argc, argv); 26 | 27 | if (argc < 3) { 28 | cerr << "Usage: sound " << endl; 29 | return -1; 30 | } 31 | 32 | int sound = SoundUtil::getInstance()->loadSample(argv[1]); 33 | if (sound < 0) { 34 | cerr << "Sound not loaded" << endl; 35 | return -1; 36 | } 37 | 38 | int music = SoundUtil::getInstance()->loadMusic(argv[2]); 39 | if (music < 0) { 40 | cerr << "Sound not loaded" << endl; 41 | return -1; 42 | } 43 | SoundUtil::getInstance()->playMusic(music, true); 44 | 45 | while (!Keyboard::isKeyDown(SDLK_ESCAPE)) { 46 | if (Keyboard::isKeyDown(SDLK_SPACE)) { 47 | SoundUtil::getInstance()->playSample(sound, false); 48 | } 49 | engine->tick(); 50 | engine->delay(20); 51 | } 52 | //delete(engine); 53 | return 0; 54 | } 55 | 56 | #if EM_USE_ALLEGRO 57 | END_OF_MAIN(); 58 | #endif 59 | -------------------------------------------------------------------------------- /base/Sound.cpp: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | Sound.cpp - description 3 | ------------------- 4 | begin : Wed Jan 26 2000 5 | copyright : (C) 2000 by Henrik Enqvist 6 | email : henqvist@excite.com 7 | ***************************************************************************/ 8 | 9 | #include 10 | 11 | #include "Private.h" 12 | #include "Sound.h" 13 | #include "Group.h" 14 | 15 | Sound::Sound(EmSample* sample, float dist, bool b3D) { 16 | m_b3D = b3D; 17 | m_fDistance = dist; 18 | p_Sample = sample; 19 | m_vtxSrc.x = 0; 20 | m_vtxSrc.y = 0; 21 | m_vtxSrc.z = 0; 22 | p_Parent = NULL; 23 | } 24 | 25 | void Sound::setParent(Group* g) { 26 | p_Parent = g; 27 | } 28 | 29 | 30 | void Sound::play(bool loop) { 31 | m_bLoop = loop; 32 | if (p_Sample == NULL) return; 33 | } 34 | 35 | void Sound::adjust() { 36 | EM_COUT("Sound::adjust()" << endl, 1); 37 | // int vol, pan; 38 | // float r2; 39 | 40 | if (!m_b3D) return; 41 | if (p_Sample == NULL) return; 42 | 43 | // Volume. 44 | /* r2 = (vtxAlPos.x*vtxAlPos.x + vtxAlPos.y*vtxAlPos.y + vtxAlPos.z*vtxAlPos.z)/100; 45 | r2 /= fDistance; 46 | r2 = EM_MAX(1, r2); 47 | vol = (int)((float)255/r2); 48 | vol = (int)EM_MIN(vol, 255); 49 | 50 | // Pan 51 | if ( EM_ZERO(vtxAlPos.z)) { 52 | if (vtxAlPos.x > 0) pan = 255; 53 | else pan = 0; 54 | } else { 55 | pan = (int) EMath::emAtan (vtxAlPos.x/ABS(vtxAlPos.z))*2; 56 | pan += 127; 57 | pan = EM_MAX(0, pan); 58 | }*/ 59 | } 60 | -------------------------------------------------------------------------------- /data/pinball.xpm: -------------------------------------------------------------------------------- 1 | /* XPM */ 2 | static char *pinball[]={ 3 | "32 32 13 1", 4 | ". c None", 5 | "i c #000000", 6 | "# c #000080", 7 | "a c #0000c0", 8 | "b c #0000ff", 9 | "c c #0058c0", 10 | "d c #0080ff", 11 | "g c #00c000", 12 | "h c #00ff00", 13 | "f c #58a8ff", 14 | "k c #808080", 15 | "j c #c0c000", 16 | "e c #ffffff", 17 | "............########............", 18 | ".........####aaaaaa####.........", 19 | ".......###aaaaaaaaaaaa###.......", 20 | "......##aaabbbbbbbaaabba##......", 21 | ".....##aaabbbbbbbbbcdddbb##.....", 22 | "....##aabbbbbbbbbbcddeeedb##....", 23 | "...##abbbbbbbbbbbbddfeeeedb##...", 24 | "..##aabbbbbbbbbbbbcddfeeeedb##..", 25 | "..#aabbbbbbbbbbbbbbcddfeeedbb#..", 26 | ".##aabbbbbbbbbbbbbbbbcdfffdda##.", 27 | ".#aabbbbbbbbbbbbbbbbbbcddddca##.", 28 | ".#abbbbbbbbbbbbbbbbbbbbcddcbaa#.", 29 | "##abbbbbbbbbbbbbbbbbbbbbbcbbaa##", 30 | "#aaaaaaaaaaaaabbbbbbbbbbbbbbbaa#", 31 | "#aaaagggggggggaaabbbbbbbbbbbbaa#", 32 | "#aagghhhhhhhhhggaaabbbbbbbbbbaa#", 33 | "#ggghhhhhhhhhhhhggaaaabbbbbaaag#", 34 | "#ghhhhiiiihhhhhhhgggaaaaaaaaggg#", 35 | "#ghhhiieeiihhhhhhhhgggggggggghg#", 36 | "#ghhhieeieiiihhhhhhhhhhhhhhhhh##", 37 | ".#ghhieieejiiihhhhhhhhhhhhhhhg#.", 38 | ".#ghhiieejjiiiiihhhhhhhhhhhhhg#.", 39 | ".##ghhiijjjiiiiijjjhhhhhhhhhg##.", 40 | "..#ghhiiiiiiiekijjjjhhhhhhhhg#..", 41 | "..##ghhiiiiieeeejjjjjhhhhhhg##..", 42 | "...##ghiiiieeeeejjjjjhhhhhg##...", 43 | "....##ghiiieeeieiijjhhhhhg##....", 44 | ".....##ghiijjjekiiihhhhhg##.....", 45 | "......##ggjjjjjiiihhhhgg##......", 46 | ".......###jjjjjiihhggg###.......", 47 | ".........####jjgggg####.........", 48 | "............########............"}; 49 | -------------------------------------------------------------------------------- /base/BillBoard.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | BillBoard.h - description 3 | ------------------- 4 | begin : Sun Dec 16 2001 5 | copyright : (C) 2001 by henqvist 6 | email : henqvist@excite.com 7 | ***************************************************************************/ 8 | 9 | #ifndef BILLBOARD_H 10 | #define BILLBOARD_H 11 | 12 | #define EM_BILLBOARD_TRANS 1 13 | #define EM_BILLBOARD_ALPHATEST 2 14 | 15 | #include "TextureUtil.h" 16 | #include "EMath.h" 17 | 18 | class Group; 19 | 20 | /** A billboard is a flat polygon that always will face the viewer. 21 | * An easy speed hack is to use a billboards instead of a complex 22 | * shapes, e.g. the monsters in Doom. */ 23 | class BillBoard { 24 | public: 25 | BillBoard(EmTexture * tex, float sizex, float sizey); 26 | ~BillBoard(); 27 | void setTexture(EmTexture * tex); 28 | void setZOffset(float z) { m_fZOffset = z; }; 29 | void setSize(float x, float y) { m_fSizexD2 = x/2; m_fSizeyD2 = y/2; }; 30 | void setParent(Group*); 31 | void setUV(float u, float v, int i) { m_aTexCoord[i].u = u; m_aTexCoord[i].v = v; }; 32 | void setProperty(int property); 33 | void unsetProperty(int property); 34 | 35 | Vertex3D m_vtxSrc; 36 | Vertex3D m_vtxTrans; 37 | Vertex3D m_vtxAlign; 38 | private: 39 | friend class OpenGLVisitor; 40 | friend class AllegroVisitor; 41 | 42 | EmTexture* m_Texture; 43 | Group* p_Parent; 44 | int m_iProperties; 45 | float m_fSizexD2, m_fSizeyD2; 46 | float m_fZOffset; 47 | TexCoord m_aTexCoord[4]; 48 | }; 49 | 50 | 51 | #endif // BILLBOARD_H 52 | -------------------------------------------------------------------------------- /addon/Grid.cpp: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | Grid.cpp - description 3 | ------------------- 4 | begin : Tue Feb 8 2000 5 | copyright : (C) 2000 by Henrik Enqvist 6 | email : henqvist@excite.com 7 | ***************************************************************************/ 8 | 9 | #include "Private.h" 10 | #include "Grid.h" 11 | #include "Polygon.h" 12 | 13 | Grid::Grid(EmTexture* texture, float sizex, float sizey, int step, float bmStep, 14 | float fR, float fG, float fB, float fA) : Shape3D((step+1)*(step+1), step*step) { 15 | Polygon3D * poly; 16 | 17 | sizex /= step; 18 | sizey /= step; 19 | 20 | { for (int a=0; a<=step; a++) { 21 | for (int b=0; b<=step; b++) { 22 | this->add( a*sizex - step*sizex*0.5, 0, -b*sizey + step*sizey*0.5, 23 | fR, fG, fB, fA, b*bmStep, a*bmStep); 24 | } 25 | } } 26 | 27 | { for (int a=0; aadd(a + b*(step+1), a*bmStep, b*bmStep, fR, fG, fB, fA); 31 | // poly->add((a+1) + b*(step+1), (a+1)*bmStep, b*bmStep, fR, fG, fB, fA); 32 | // poly->add((a+1) + (b+1)*(step+1), (a+1)*bmStep, (b+1)*bmStep, fR, fG, fB, fA); 33 | // poly->add(a + (b+1)*(step+1), a*bmStep, (b+1)*bmStep, fR, fG, fB, fA); 34 | poly->add(a + b*(step+1)); 35 | poly->add((a+1) + b*(step+1)); 36 | poly->add((a+1) + (b+1)*(step+1)); 37 | poly->add(a + (b+1)*(step+1)); 38 | this->add(poly); 39 | } 40 | } } 41 | 42 | this->setTexture(texture); 43 | this->countNormals(); 44 | } 45 | 46 | -------------------------------------------------------------------------------- /docs/news.md: -------------------------------------------------------------------------------- 1 | # NEWS # 2 | 3 | ## NEWS 2020-12-18 ## 4 | 5 | New release with "pincab" features for 20 years anniversary. 6 | 7 | Mouse control 8 | Startup scripts to boot to pincab 9 | Images for PC or Raspberry Pi (thanks debos) 10 | 11 | More: 12 | 13 | https://github.com/adoptware/pinball/releases/tag/0.3.20201218 14 | https://mastodon.social/@rzr/105406612101253785 15 | 16 | ## NEWS 2020-11-22 ## 17 | 18 | 20y Anniversary? 19 | 20 | And what wouldn't be a better way to celebrate than for Phil Coval 21 | to give a presentation about a DIY pinball cabinet. 22 | 23 | 24 | [![pinball-video]( 25 | https://diode.zone/lazy-static/previews/b764fc94-b455-45f5-a62a-24ec6131112e.jpg 26 | )]( 27 | https://rzr.github.io/rzr-presentations/docs/pinball/#/13 28 | "pinball") 29 | 30 | Demo features 2 extra tables contributed from community: 31 | 32 | - 33 | - 34 | 35 | Boths tables are packaged in Debian. 36 | 37 | Subscribe to fediverse https://purl.org/rzr/pinball for updates. 38 | 39 | ## NEWS 2010-12-25 ## 40 | 41 | Anniversary? 42 | 43 | It is now close to ten years since the project started. 44 | Some of the tags in the older source files dates back to January 2000. 45 | That's a loooong time ago. 46 | 47 | Time flies when you're having fun. 48 | My system back then was an AMD 500Mhz with a Voodoo3 card and a 15" CRT monitor, 49 | nowadays it is a MacBook 13". Still, nothing has really changed. 50 | y BMI is the same, HTML is still written with Emacs in a shell, for-loops are unrolled, 51 | the internet is slow and my car can't fly ;). 52 | 53 | Merry Christmas to everyone and Game On! 54 | -------------------------------------------------------------------------------- /test/simple.cpp: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | Simple test. A cube should be visible in the middle of the screen. 3 | The arrow keys rotates the cube. 4 | ***************************************************************************/ 5 | 6 | #include 7 | 8 | #include "Private.h" 9 | #include "Engine.h" 10 | #include "Camera.h" 11 | #include "Cube.h" 12 | #include "KeyRotBehavior.h" 13 | #include "Keyboard.h" 14 | //#include "Cylinder.h" 15 | 16 | /** Main */ 17 | int main(int argc, char *argv[]) { 18 | cerr << "Simple emilia test." << endl; 19 | 20 | // Create the engine. 21 | Engine* engine = new Engine(argc, argv); 22 | engine->setLightning(0.7f, 0.1f); 23 | 24 | // Add a camera. Move a bit. 25 | Camera* camera = new Camera(); 26 | Group* groupCamera = new Group(); 27 | engine->add(groupCamera); 28 | groupCamera->setCamera(camera); 29 | groupCamera->setTranslation(0, 0, 3); 30 | engine->setEngineCamera(groupCamera); 31 | // Add a cube. 32 | Cube* cube = new Cube(1.0, 1.0, 1.0, 0.0, 1.0); 33 | //Shape3D * cube = new Cylinder(1.0f, 32, 1.0f, 1.0f, 0.0f, 1.0f); 34 | Group* groupCube = new Group(); 35 | engine->add(groupCube); 36 | groupCube->addShape3D(cube); 37 | 38 | // Add a behavior to the cube 39 | KeyRotBehavior* keyRBeh = new KeyRotBehavior(); 40 | groupCube->setBehavior(keyRBeh); 41 | 42 | bool render = true; 43 | while (!Keyboard::isKeyDown(SDLK_ESCAPE)) { 44 | engine->tick(); 45 | if (render) { 46 | engine->render(); 47 | engine->swap(); 48 | } 49 | //render = engine->limitFPS(100); 50 | } 51 | delete(engine); 52 | return 0; 53 | } 54 | 55 | #if EM_USE_ALLEGRO 56 | END_OF_MAIN(); 57 | #endif 58 | -------------------------------------------------------------------------------- /extra/profile/pinball/etc/pinball/configure.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | # -*- mode: Bash; tab-width: 2; indent-tabs-mode: nil; coding: utf-8 -*- 3 | # vim:shiftwidth=4:softtabstop=4:tabstop=4: 4 | # SPDX-License-Identifier: GPL-2.0+ 5 | 6 | set -x 7 | set -e 8 | 9 | self_dir=$(dirname -- "$0") 10 | extra_dir=$(realpath -- "${self_dir}/../../../../../extra") 11 | 12 | project="pinball" 13 | sudo=$(which sudo || echo "") 14 | 15 | cd /etc/pinball 16 | 17 | . pinball.env.sh 18 | 19 | set 20 | 21 | ${sudo} chmod u+rx ${self_dir}/*.sh 22 | 23 | ${sudo} install -d /etc/default 24 | ${sudo} install ${self_dir}/pinball /etc/default/pinball 25 | 26 | ${sudo} systemctl get-default | grep 'graphical.target' 27 | 28 | ${sudo} journalctl --rotate \ 29 | && ${sudo} journalctl --vacuum-time=1s 30 | 31 | ${sudo} systemctl stop pinball ||: 32 | ${sudo} systemctl stop xinit ||: 33 | 34 | ${sudo} systemctl disable pinball ||: 35 | ${sudo} systemctl disable xinit ||: 36 | 37 | ${sudo} systemctl daemon-reload ||: 38 | # TODO install from /lib/systemd/system/ on debian 39 | ${sudo} systemctl enable /etc/${project}/${PINBALL_DISPLAY_MANAGER}.service 40 | 41 | if [ "${PINBALL_DISPLAY_MANAGER}" = "weston" ] ; then 42 | ${sudo} systemctl enable /etc/${project}/${project}.service 43 | ${sudo} install -d /etc/xdg/weston 44 | ${sudo} ln -fs ../../${project}/weston.ini /etc/xdg/weston/ 45 | fi 46 | 47 | cat< 19 | #endif 20 | 21 | #include "Visitor.h" 22 | 23 | #define EM_ALLEGRO_GCOL_TEX 0 24 | #define EM_ALLEGRO_GCOL_TEX_TRANS 2 25 | #define EM_ALLEGRO_CLEAN 4 26 | 27 | class Group; 28 | class Shape3D; 29 | 30 | #if EM_DEBUG 31 | extern int em_poly; 32 | extern float em_poly_m; 33 | #endif 34 | 35 | /** @author Henrik Enqvist */ 36 | 37 | class AllegroVisitor : public Visitor { 38 | protected: 39 | AllegroVisitor(); 40 | public: 41 | ~AllegroVisitor(); 42 | static AllegroVisitor * getInstance(); 43 | void visit(Group* g); 44 | void empty(); 45 | int getMode() { return m_iMode; }; 46 | void setMode(int m) { m_iMode = m; }; 47 | private: 48 | void visit(Shape3D* s, Group* g); 49 | static AllegroVisitor * p_AllegroVisitor; 50 | int m_iMode; 51 | #if EM_USE_ALLEGRO 52 | V3D_f alleg_vtx[256]; 53 | V3D_f * alleg_vtx_p[256]; 54 | V3D_f alleg_clip[256]; 55 | V3D_f * alleg_clip_p[256]; 56 | V3D_f alleg_tmp[256]; 57 | V3D_f * alleg_tmp_p[256]; 58 | int int_tmp[256]; 59 | #endif 60 | }; 61 | 62 | #endif // ALLEGROVISITOR_H 63 | 64 | -------------------------------------------------------------------------------- /src/BounceBehavior.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | BounceBehavior.h - description 3 | ------------------- 4 | begin : Thu Mar 9 2000 5 | copyright : (C) 2000 by 6 | email : 7 | ***************************************************************************/ 8 | 9 | #ifndef BOUNCEBEHAVIOR_E 10 | #define BOUNCEBEHAVIOR_E 11 | 12 | #include "Behavior.h" 13 | #include "EMath.h" 14 | #include "StateMachine.h" 15 | 16 | #define MAX_SPEED 0.5f 17 | #define FIRE_SPEED 0.4f 18 | #define MAX_SPEED_Y_DOWN (MAX_SPEED*0.5f) 19 | #define SPEED_FCT 0.6f 20 | #define Y_GRAVITY -(SPEED_FCT*0.005f) // -SPEED_FCT/200 21 | #define Z_GRAVITY (SPEED_FCT*0.002f) // SPEED_FCT/500 22 | #define BORDER (SPEED_FCT*0.05f) 23 | #define BORDER2 (SPEED_FCT*0.02f) 24 | 25 | #define ARM_TABLE_SIZE 8 // do not use less than 3 26 | #define ARM_WIDTH 6.1 27 | 28 | /** A behavior for the pinball demo. */ 29 | 30 | class BounceBehavior : public Behavior { 31 | public: 32 | BounceBehavior(int ball); 33 | ~BounceBehavior(); 34 | void onTick(); 35 | void StdOnSignal(); 36 | void onCollision(const Vertex3D & vtx1, const Vertex3D & vtx2, Group* g); 37 | void getDirection(Vertex3D & vtx); 38 | inline bool isAlive() { return m_bAlive; }; 39 | inline void setFire(bool f) { m_bFire = f; }; 40 | /** drops the ball at x,y,z */ 41 | void activateBall(float x, float y, float z); 42 | private: 43 | void checkSpeed(); 44 | 45 | bool m_bAlive; 46 | int m_iBall; 47 | Vertex3D m_vtxDir; 48 | Vertex3D m_vtxOldDir; 49 | int m_iDirFactor; 50 | int m_iCollisionPrio; 51 | bool m_bFire; 52 | bool m_bStopped; 53 | }; 54 | 55 | #endif // BounceBehavior 56 | -------------------------------------------------------------------------------- /src/BumperBehavior.cpp: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | BumperBehavopr.cpp - description 3 | ------------------- 4 | begin : Thu Mar 9 2000 5 | copyright : (C) 2000 by 6 | email : 7 | ***************************************************************************/ 8 | 9 | #include "Private.h" 10 | #include "BumperBehavior.h" 11 | #include "Group.h" 12 | #include "Pinball.h" 13 | #include "Polygon.h" 14 | #include "Shape3D.h" 15 | #include "SoundUtil.h" 16 | #include "Loader.h" 17 | 18 | BumperBehavior::BumperBehavior() : Behavior() { 19 | m_fPower = 0.5f; 20 | m_bTilt = false; 21 | m_iLightCounter = -1; 22 | m_iSound = -1; 23 | m_sigBump = Loader::getInstance()->getSignal("bump"); 24 | this->setType(PBL_TYPE_BUMPERBEH); 25 | } 26 | 27 | BumperBehavior::~BumperBehavior() { 28 | } 29 | 30 | void BumperBehavior::onTick() { 31 | if (m_iLightCounter > -1) m_iLightCounter--; 32 | if (m_iLightCounter == 0 ) SetLightOn(false); 33 | } 34 | 35 | void BumperBehavior::StdOnSignal() { 36 | OnSignal(PBL_SIG_RESET_ALL) { 37 | m_bTilt = false; 38 | SetLightOn(false); 39 | m_iLightCounter = -1; 40 | } 41 | ElseOnSignal(PBL_SIG_TILT) { 42 | m_bTilt = true; 43 | } 44 | } 45 | 46 | void BumperBehavior::StdOnCollision() { 47 | EM_COUT("BumperBehavior::StdOnCollision()", 0); 48 | 49 | if (m_bTilt) return; 50 | 51 | OnCallerProperty( PBL_BALL ) { 52 | if (m_iLightCounter > 10) { 53 | return; 54 | } 55 | m_iLightCounter = 20; 56 | SetLightOn(true); 57 | SendSignal(m_sigBump, 0, this->getParent(), NULL); 58 | SoundUtil::getInstance()->playSample(m_iSound, false); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /test/thread.cpp: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | Threaded rendering test. A cube should be visible in the middle of the screen. 3 | The arrow keys rotates the cube. 4 | ***************************************************************************/ 5 | 6 | #include 7 | 8 | #include "Private.h" 9 | #include "Engine.h" 10 | #include "Camera.h" 11 | #include "Cube.h" 12 | #include "KeyRotBehavior.h" 13 | #include "Keyboard.h" 14 | #include "EMath.h" 15 | 16 | /** Main */ 17 | int main(int argc, char *argv[]) { 18 | cerr << "Simple emilia test." << endl; 19 | #if EM_THREADS 20 | // Create the engine. 21 | Engine* engine = new Engine(argc, argv); 22 | engine->setLightning(0.7f, 0.1f); 23 | 24 | // Add a camera. Move a bit. 25 | Camera* camera = new Camera(); 26 | Group* groupCamera = new Group(); 27 | engine->add(groupCamera); 28 | groupCamera->setCamera(camera); 29 | groupCamera->setTranslation(0, 0, 3); 30 | engine->setEngineCamera(groupCamera); 31 | // Add a cube. 32 | Cube* cube = new Cube(1.0, 1.0, 1.0, 0.0, 1.0); 33 | Group* groupCube = new Group(); 34 | engine->add(groupCube); 35 | groupCube->addShape3D(cube); 36 | 37 | // Add a behavior to the cube 38 | KeyRotBehavior* keyRBeh = new KeyRotBehavior(); 39 | groupCube->setBehavior(keyRBeh); 40 | 41 | engine->startTickThread(); 42 | while (!Keyboard::isKeyDown(SDLK_ESCAPE)) { 43 | engine->renderThreadSafe(); 44 | engine->swap(); 45 | } 46 | 47 | delete(engine); 48 | return 0; 49 | #else 50 | cerr << "This version of Emilia is not compiled with threaded rendering." << endl; 51 | cerr << "Add the line: AC_DEFINE(EM_THREADS) to 'configure.in' to enable threads." << endl; 52 | return 0; 53 | #endif 54 | } 55 | 56 | #if EM_USE_ALLEGRO 57 | END_OF_MAIN(); 58 | #endif 59 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # .gitignore 2 | 3 | # Git 4 | *~* 5 | *.tmp 6 | 7 | # Temporary places 8 | **/tmp/ 9 | 10 | # Generated files 11 | *.a 12 | *.o 13 | */.deps/*.Po 14 | */.deps/*.Plo 15 | **/.deps/ 16 | **/.libs/ 17 | */Makefile 18 | */Makefile.in 19 | *~ 20 | INSTALL 21 | Makefile 22 | Makefile.in 23 | README 24 | aclocal.m4 25 | compile 26 | /config.* 27 | /configure 28 | debian/*.debhelper.log 29 | debian/*.substvars 30 | debian/.debhelper/ 31 | debian/autoreconf.* 32 | debian/debhelper-build-stamp 33 | debian/files 34 | debian/pinball*/ 35 | debian/tmp/ 36 | depcomp 37 | install-sh 38 | libltdl/ 39 | libtool 40 | ltmain.sh 41 | manpage.links 42 | manpage.refs 43 | missing 44 | pinball-config 45 | pinball.6 46 | 47 | # Autotools 48 | compile 49 | depcomp 50 | pinconfig.h 51 | pinconfig.h.in 52 | autom4te.cache/ 53 | stamp-h1 54 | 55 | # Libtool 56 | data/*.libs/ 57 | data/*/*.lo 58 | data/*/*.la 59 | 60 | Makefile 61 | Makefile.in 62 | aclocal.m4 63 | addon/Makefile 64 | addon/Makefile.in 65 | base/Makefile 66 | base/Makefile.in 67 | config.guess 68 | config.sub 69 | data/Makefile.in 70 | data/professor/Makefile.in 71 | data/tux/Makefile.in 72 | install-sh 73 | libltdl/ 74 | ltmain.sh 75 | missing 76 | pinconfig.h 77 | pinconfig.h.in 78 | src/Makefile.in 79 | test/Makefile.in 80 | 81 | 82 | # debos 83 | *.img 84 | *.img.* 85 | *.qcow2 86 | *.snap 87 | *_armhf.txt 88 | 89 | # Output 90 | test/unittest 91 | src/pinball 92 | test/billboard 93 | test/collision 94 | test/explode 95 | test/font 96 | test/joy 97 | test/*.la 98 | test/light 99 | test/load 100 | test/math 101 | test/menu 102 | test/misc 103 | test/*.lo 104 | test/scale 105 | test/signal 106 | test/simple 107 | test/sound 108 | test/texture 109 | test/thread 110 | test/trans 111 | test/varray 112 | -------------------------------------------------------------------------------- /src/Makefile.am: -------------------------------------------------------------------------------- 1 | AUTOMAKE_OPTIONS = gnu 2 | 3 | pinlibdir = $(libdir)/pinball 4 | pinincludedir = $(includedir)/pinball 5 | 6 | bin_PROGRAMS = pinball 7 | 8 | pinlib_LIBRARIES = libemilia_pin.a 9 | 10 | AM_CPPFLAGS = -I../base -I../addon @INCLTDL@ 11 | 12 | pinball_LDADD = libemilia_pin.a ../addon/libemilia_addon.a ../base/libemilia_base.a @LIBLTDL@ 13 | pinball_LDFLAGS = -export-dynamic 14 | 15 | pinball_SOURCES = Pinball.cpp 16 | 17 | libemilia_pin_a_SOURCES = \ 18 | ArmBehavior.cpp \ 19 | BallGroup.cpp \ 20 | BounceBehavior.cpp \ 21 | BumperBehavior.cpp \ 22 | EyeBehavior.cpp \ 23 | LoaderModule.cpp \ 24 | Loader.cpp \ 25 | Obj3dsUtil.cpp \ 26 | PlungerBehavior.cpp \ 27 | Score.cpp \ 28 | Script.cpp \ 29 | StateBehavior.cpp \ 30 | Table.cpp 31 | 32 | # libemilia_pin_la_SOURCES = $(libemilia_pin_a_SOURCES) 33 | 34 | pininclude_HEADERS = \ 35 | ArmBehavior.h \ 36 | BallGroup.h \ 37 | BounceBehavior.h \ 38 | BumperBehavior.h \ 39 | EyeBehavior.h \ 40 | FakeModuleBehavior.h \ 41 | LoaderModule.h \ 42 | Loader.h \ 43 | Obj3dsUtil.h \ 44 | Pinball.h \ 45 | PlungerBehavior.h \ 46 | Score.h \ 47 | Script.h \ 48 | SrcTest.h \ 49 | StateBehavior.h \ 50 | Table.h 51 | 52 | # !+rzr : This trick workaround a bad generated rule (under Linux mingw32) 53 | # src/ litool returns: -L/usr/local//lib /usr/lib/libjpeg.so 54 | # make -C src wpinball.exe (build the final programm) 55 | # Pinball.o \ 56 | # libemilia_pin.a libemilia_addon.a libemilia_base.a libltdlc.a 57 | wpinball.exe: ${pinball_OBJECTS} ${pinball_DEPENDENCIES} 58 | ${GCCLOCALDIR}g++ -g -W -Wall -O2 -o$@ $^ \ 59 | -lSDL_mixer -lvorbisfile -lvorbis -logg -lsmpeg \ 60 | -lSDL_image -lSDLmain -lSDL \ 61 | -lopengl32 -ljpeg -lpng \ 62 | -lwinmm -luser32 -lgdi32 -ldxguid \ 63 | -lmingw32 -lSDLmain -lSDL -mwindows \ 64 | -L${GCCLOCALDIR}../lib 65 | # !-rzr : # have to solve it later # -lstdc++ 66 | -------------------------------------------------------------------------------- /test/camera.cpp: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | Simple test. A cube should be visible in the middle of the screen. 3 | The arrow keys rotates the cube. 4 | ***************************************************************************/ 5 | 6 | #include "Engine.h" 7 | #include "Camera.h" 8 | #include "Cube.h" 9 | #include "Keyboard.h" 10 | #include "KeyRotBehavior.h" 11 | #include "KeyBehavior.h" 12 | #include "Grid.h" 13 | 14 | /** Main */ 15 | int main(int argc, char *argv[]) { 16 | cerr << "Simple emilia test." << endl; 17 | 18 | // Create the engine. 19 | Engine* engine = new Engine(argc, argv); 20 | engine->setLightning(0.5f, 0.1f); 21 | 22 | // Add a camera. Add some animiation to the camera. 23 | Group* groupC1 = new Group(); 24 | Group* groupC2 = new Group(); 25 | Group* groupC3 = new Group(); 26 | Group* groupC4 = new Group(); 27 | 28 | engine->add(groupC1); 29 | groupC1->add(groupC2); 30 | groupC2->add(groupC3); 31 | groupC3->add(groupC4); 32 | 33 | Cube* cube2 = new Cube(1.0, 1, 1, 0, 1); 34 | groupC2->addShape3D(cube2); 35 | groupC2->setTranslation(0, 0, 2); 36 | 37 | Cube* cube3 = new Cube(1.0, 0, 1, 1, 1); 38 | groupC3->addShape3D(cube3); 39 | groupC3->setTranslation(0, 0, 2); 40 | 41 | Camera* camera = new Camera(); 42 | groupC4->setCamera(camera); 43 | groupC4->setTranslation(0, 1, 2); 44 | engine->setEngineCamera(groupC4); 45 | 46 | Grid* grid = new Grid(NULL, 10, 10, 1, 0, 1, 1, 1, 1); 47 | engine->addShape3D(grid); 48 | 49 | Behavior* keyRBeh = new KeyRotBehavior(); 50 | groupC1->addBehavior(keyRBeh); 51 | 52 | Behavior* keyBeh = new KeyBehavior(); 53 | groupC3->addBehavior(keyBeh); 54 | 55 | while (!Keyboard::isKeyDown(SDLK_ESCAPE)) { 56 | engine->tick(); 57 | engine->render(); 58 | engine->swap(); 59 | SDL_Delay(50); 60 | } 61 | delete(engine); 62 | return 0; 63 | } 64 | -------------------------------------------------------------------------------- /.dockerignore: -------------------------------------------------------------------------------- 1 | # .dockerignore 2 | .git/ 3 | Dockerfile 4 | docker-compose.yml 5 | 6 | # .gitignore 7 | 8 | # Git 9 | *~* 10 | *.tmp 11 | 12 | # Temporary places 13 | **/tmp/ 14 | 15 | # Generated files 16 | *.a 17 | *.o 18 | */.deps/*.Po 19 | */.deps/*.Plo 20 | **/.deps/ 21 | **/.libs/ 22 | */Makefile 23 | */Makefile.in 24 | *~ 25 | INSTALL 26 | Makefile 27 | Makefile.in 28 | README 29 | aclocal.m4 30 | compile 31 | /config.* 32 | /configure 33 | debian/*.debhelper.log 34 | debian/*.substvars 35 | debian/.debhelper/ 36 | debian/autoreconf.* 37 | debian/debhelper-build-stamp 38 | debian/files 39 | debian/pinball*/ 40 | debian/tmp/ 41 | depcomp 42 | install-sh 43 | libltdl/ 44 | libtool 45 | ltmain.sh 46 | manpage.links 47 | manpage.refs 48 | missing 49 | pinball-config 50 | pinball.6 51 | 52 | # Autotools 53 | compile 54 | depcomp 55 | pinconfig.h 56 | pinconfig.h.in 57 | autom4te.cache/ 58 | stamp-h1 59 | 60 | # Libtool 61 | data/*.libs/ 62 | data/*/*.lo 63 | data/*/*.la 64 | 65 | Makefile 66 | Makefile.in 67 | aclocal.m4 68 | addon/Makefile 69 | addon/Makefile.in 70 | base/Makefile 71 | base/Makefile.in 72 | config.guess 73 | config.sub 74 | data/Makefile.in 75 | data/professor/Makefile.in 76 | data/tux/Makefile.in 77 | install-sh 78 | libltdl/ 79 | ltmain.sh 80 | missing 81 | pinconfig.h 82 | pinconfig.h.in 83 | src/Makefile.in 84 | test/Makefile.in 85 | 86 | 87 | # debos 88 | *.img 89 | *.img.* 90 | *.qcow2 91 | *.snap 92 | *_armhf.txt 93 | 94 | # Output 95 | test/unittest 96 | src/pinball 97 | test/billboard 98 | test/collision 99 | test/explode 100 | test/font 101 | test/joy 102 | test/*.la 103 | test/light 104 | test/load 105 | test/math 106 | test/menu 107 | test/misc 108 | test/*.lo 109 | test/scale 110 | test/signal 111 | test/simple 112 | test/sound 113 | test/texture 114 | test/thread 115 | test/trans 116 | test/varray 117 | -------------------------------------------------------------------------------- /debian/rules: -------------------------------------------------------------------------------- 1 | #!/usr/bin/make -f 2 | export DH_VERBOSE = 1 3 | 4 | DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) 5 | DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) 6 | DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH) 7 | 8 | ifneq (,$(findstring alpha,$(DEB_BUILD_GNU_TYPE))) 9 | CFLAGS += -mieee 10 | CXXFLAGS += -mieee 11 | endif 12 | 13 | export DEB_BUILD_MAINT_OPTIONS = hardening=+all 14 | DPKG_EXPORT_BUILDFLAGS = 1 15 | include /usr/share/dpkg/buildflags.mk 16 | CFLAGS += -Wall 17 | 18 | %: 19 | dh $@ 20 | 21 | .PHONY: clean 22 | clean: 23 | dh clean 24 | rm -rf libltdl 25 | 26 | .PHONY: override_dh_auto_configure 27 | override_dh_auto_configure: bootstrap 28 | ${ 6 | 7 | #include "Private.h" 8 | #include "Engine.h" 9 | #include "Camera.h" 10 | #include "BillBoard.h" 11 | #include "KeyBehavior.h" 12 | #include "Keyboard.h" 13 | #include "TextureUtil.h" 14 | #include "Cube.h" 15 | 16 | /** Main */ 17 | int main(int argc, char *argv[]) { 18 | cerr << "BillBoard test." << endl; 19 | 20 | if (argc < 2) { 21 | cerr << "Usage: billboard " << endl; 22 | return 0; 23 | } 24 | 25 | // Create the engine. 26 | Engine* engine = new Engine(argc, argv); 27 | engine->setLightning(0.5f, 0.1f); 28 | 29 | // Add a camera. Move a bit. 30 | Camera* camera = new Camera(); 31 | Group* groupCamera = new Group(); 32 | engine->add(groupCamera); 33 | groupCamera->setCamera(camera); 34 | groupCamera->setTranslation(0, 0, 3); 35 | engine->setEngineCamera(groupCamera); 36 | 37 | // Add a cube 38 | Cube* cube = new Cube(0.5, 1, 1, 0, 1); 39 | Group* groupC = new Group(); 40 | groupC->addShape3D(cube); 41 | engine->add(groupC); 42 | 43 | // Load a texture 44 | EmTexture* texture = TextureUtil::getInstance()->loadTexture(argv[1]); 45 | 46 | // Add a BillBoard 47 | BillBoard* billboard = new BillBoard(texture, 1.0, 1.0); 48 | billboard->setProperty(EM_BILLBOARD_ALPHATEST); 49 | // billboard->setProperty(EM_BILLBOARD_TRANS); 50 | Group* groupBB = new Group(); 51 | engine->add(groupBB); 52 | groupBB->setBillBoard(billboard); 53 | 54 | // Add a behavior to the billboard 55 | KeyBehavior* keyBeh = new KeyBehavior(); 56 | groupBB->setBehavior(keyBeh); 57 | 58 | while (!Keyboard::isKeyDown(SDLK_ESCAPE)) { 59 | engine->tick(); 60 | engine->render(); 61 | engine->swap(); 62 | } 63 | delete(engine); 64 | return 0; 65 | } 66 | 67 | #if EM_USE_ALLEGRO 68 | END_OF_MAIN(); 69 | #endif 70 | -------------------------------------------------------------------------------- /test/font.cpp: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | Font test. A cube should be visible in the middle of the screen. 3 | Some text applied on the screen. 4 | The arrow keys rotates the cube. 5 | ***************************************************************************/ 6 | 7 | #include 8 | 9 | #include "Private.h" 10 | #include "Engine.h" 11 | #include "Camera.h" 12 | #include "Cube.h" 13 | #include "KeyRotBehavior.h" 14 | #include "Keyboard.h" 15 | #include "EmFont.h" 16 | 17 | /** Main */ 18 | int main(int argc, char *argv[]) { 19 | cerr << "Font test." << endl; 20 | 21 | if (argc < 2) { 22 | cerr << "Usage: font " << endl; 23 | return 0; 24 | } 25 | 26 | // Create the engine. 27 | Engine* engine = new Engine(argc, argv); 28 | engine->setLightning(0.5f, 0.1f); 29 | 30 | // Add a camera. Move a bit. 31 | Camera* camera = new Camera(); 32 | Group* groupCamera = new Group(); 33 | engine->add(groupCamera); 34 | groupCamera->setCamera(camera); 35 | groupCamera->setTranslation(0, 0, 3); 36 | engine->setEngineCamera(groupCamera); 37 | 38 | // Add a cube. 39 | Cube* cube = new Cube(1.0, 1,1,0,1); 40 | Group* groupCube = new Group(); 41 | engine->add(groupCube); 42 | groupCube->addShape3D(cube); 43 | 44 | // Add a behavior to the cube 45 | KeyRotBehavior* keyRBeh = new KeyRotBehavior(); 46 | groupCube->setBehavior(keyRBeh); 47 | 48 | // Aquire the singleton font object. 49 | EmFont* font = EmFont::getInstance(); 50 | font->loadFont(argv[1]); 51 | 52 | while (!Keyboard::isKeyDown(SDLK_ESCAPE)) { 53 | engine->tick(); 54 | engine->render(); 55 | font->printRow("the brown fox jumped over", 0); 56 | font->printRow("the lazy dog :;<=>?@ {}", 1); 57 | font->printRow("1234567890 !\"#$%&'()*+,-./", 2); 58 | font->printRow("press esc to quit", 3); 59 | engine->swap(); 60 | } 61 | delete(engine); 62 | return 0; 63 | } 64 | 65 | #if EM_USE_ALLEGRO 66 | END_OF_MAIN(); 67 | #endif 68 | -------------------------------------------------------------------------------- /addon/Cylinder.cpp: -------------------------------------------------------------------------------- 1 | //#ident "$Id: Cylinder.cpp,v 1.7 2003/05/12 12:17:58 rzr Exp $" 2 | /*************************************************************************** 3 | Cylinder.cpp - description 4 | ------------------- 5 | begin : Wed Jan 26 2000 6 | copyright : (C) 2000 by Henrik Enqvist 7 | email : henqvist@excite.com 8 | ***************************************************************************/ 9 | 10 | #include "Private.h" 11 | #include "Cylinder.h" 12 | #include "Polygon.h" 13 | 14 | Cylinder::Cylinder(float fSize, int sides, float fR, float fG, float fB, float fA, bool bTop) : Shape3D(sides+sides, sides+2) { 15 | if (sides < 3) sides = 3; 16 | Polygon3D * p; 17 | // First ring of vertices. 18 | { for (float a=0; aadd(EMath::emSin(a/sides)*fSize/2, (float)fSize/2 , EMath::emCos(a/sides)*fSize/2, 20 | fR, fG, fB, fA, 0.0f, 0.0f); 21 | } } 22 | // Second ring. 23 | { for (float a=0; aadd(EMath::emSin(a/sides)*fSize/2, (float)-fSize/2, EMath::emCos(a/sides)*fSize/2, 25 | fR, fG, fB, fA, 0.0f, 0.0f); 26 | } } 27 | // Add vertices. 28 | // The ring of polygons. 29 | { for (int a=0; aadd(a); 32 | p->add(a+1); 33 | p->add(a+sides+1); 34 | p->add(a+sides); 35 | this->add(p); 36 | } } 37 | 38 | p = new Polygon3D(this, 4); 39 | p->add(sides-1); 40 | p->add(0); 41 | p->add(sides); 42 | p->add(sides+sides-1); 43 | this->add(p); 44 | // Top 45 | if (bTop) { 46 | p = new Polygon3D(this, sides); 47 | for (int a=sides-1; a>=0; --a) { 48 | p->add(a); 49 | } 50 | this->add(p); 51 | // Bottom 52 | p = new Polygon3D(this, sides); 53 | { for (int a=sides; aadd(a); 55 | } } 56 | this->add(p); 57 | } 58 | 59 | this->countNormals(); 60 | } 61 | -------------------------------------------------------------------------------- /base/EmFont.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | EmFont.h - description 3 | ------------------- 4 | begin : Mon Jul 23 2001 5 | copyright : (C) 2001 by Henrik Enqvist 6 | email : henqvist@excite.com 7 | ***************************************************************************/ 8 | 9 | #ifndef EMFONT_H 10 | #define EMFONT_H 11 | 12 | //#define EM_FONT_X_2 17 13 | //#define EM_FONT_Y_2 13 14 | 15 | #ifndef PRIVATE_H 16 | #error Must include Private.h before EmFont.h 17 | #endif 18 | 19 | #if EM_USE_SDL 20 | #define EM_FONTSIZE_X 0.06f*EM_RIGHT 21 | #define EM_FONTSIZE_Y 0.08f*EM_UP 22 | #endif 23 | 24 | #if EM_USE_ALLEGRO 25 | #define EM_FONTSIZE_X 0.03f 26 | #define EM_FONTSIZE_Y 0.04f 27 | #endif 28 | 29 | #include "TextureUtil.h" 30 | 31 | class Config; 32 | 33 | /** A singleton utility for fonts. */ 34 | class EmFont { 35 | public: 36 | ~EmFont(); 37 | /** Get singleton object. */ 38 | static EmFont * getInstance(); 39 | void loadFont(const char * fileName); 40 | /** If row is negative the row will be counted from bottom of screen. */ 41 | void printRow(const char * buffer, float row); 42 | /** If row is negative the row will be counted from bottom of screen. */ 43 | void printRowCenter(const char * buffer, float row); 44 | protected: 45 | #if EM_USE_SDL 46 | /** With OpenGL -1,1 is upper left. 1,-1 is lower right. */ 47 | void print(const char * buffer, float x, float y); 48 | #endif 49 | #if EM_USE_ALLEGRO 50 | /** With allegro 0,0 is upper lefter. The screen size determines the lower right. */ 51 | void print(const char * buffer, int x, int y); 52 | #endif 53 | EmFont(); 54 | private: 55 | //EmImage * m_Font; 56 | EmTexture * m_Texture; 57 | int m_iSize; 58 | float m_fFontSizeX; 59 | float m_fFontSizeY; 60 | Config * p_Config; 61 | static EmFont * p_EmFont; 62 | }; 63 | 64 | #endif // EMFONT_H 65 | -------------------------------------------------------------------------------- /base/Node.h: -------------------------------------------------------------------------------- 1 | //#ident "$Id: Node.h,v 1.8 2003/05/27 11:53:25 rzr Exp $" 2 | /*************************************************************************** 3 | Node.h - description 4 | ------------------- 5 | begin : Wed Jan 26 2000 6 | copyright : (C) 2000 by Henrik Enqvist 7 | email : henqvist@excite.com 8 | ***************************************************************************/ 9 | 10 | #ifndef NODE_H 11 | #define NODE_H 12 | 13 | #include "EMath.h" 14 | 15 | /** The Node represents the transformation of an object. Group inherits this class. */ 16 | class Node { 17 | public: 18 | Node(); 19 | ~Node(); 20 | void setTransform(float tx, float ty, float tz , float rx, float ry, float rz); 21 | void addTransform(float tx, float ty, float tz , float rx, float ry, float rz); 22 | void setTranslation(float x, float y, float z); 23 | void getTranslation(float & x, float & y, float & z); 24 | void addTranslation(float x, float y, float z); 25 | void getTranslation(Vertex3D & vtx) { 26 | this->getTranslation(vtx.x, vtx.y, vtx.z); 27 | }; 28 | void setTranslation(Vertex3D & vtx) { 29 | this->setTranslation(vtx.x, vtx.y, vtx.z); 30 | }; 31 | inline void addTranslation(Vertex3D & vtx) { 32 | m_vtxT.x += vtx.x; 33 | m_vtxT.y += vtx.y; 34 | m_vtxT.z += vtx.z; 35 | m_mtxSrc.t[0] = m_vtxT.x; 36 | m_mtxSrc.t[1] = m_vtxT.y; 37 | m_mtxSrc.t[2] = m_vtxT.z; 38 | }; 39 | void setRotation(float x, float y, float z); 40 | void getRotation(float & x, float & y, float & z); 41 | void addRotation(float x, float y, float z); 42 | void setScale(float x, float y, float z); 43 | void getScale(float & x, float & y, float & z); 44 | void addScale(float x, float y, float z); 45 | 46 | Matrix m_mtxSrc; 47 | Matrix m_mtxTrans; 48 | private: 49 | Vertex3D m_vtxT; 50 | Vertex3D m_vtxR; 51 | Vertex3D m_vtxS; 52 | }; 53 | 54 | #endif // NODE_H 55 | -------------------------------------------------------------------------------- /extra/profile/pinball/etc/init.d/pinball: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | # -*- mode: sh; tab-width: 2; indent-tabs-mode: nil; coding: utf-8 -*- 3 | # vim:shiftwidth=4:softtabstop=4:tabstop=4: 4 | # SPDX-License-Identifier: GPL-2.0+ 5 | 6 | APPLICATION=pinball 7 | PIDFILE=/var/run/${APPLICATION}.pid 8 | BINFILE=/usr/bin/${APPLICATION} 9 | SCRIPTNAME=/etc/init.d/${APPLICATION}.sh 10 | LOGFILE=/tmp/$APPLICATION.log.txt 11 | 12 | . /etc/init.d/functions 13 | 14 | . /etc/${APPLICATION}/${APPLICATION}.env.sh 15 | export PINBALL_TABLE=tux 16 | attempts=10 17 | 18 | case "$1" in 19 | start) 20 | echo -n "Starting ${APPLICATION} service: " 21 | . /etc/profile 22 | . "/etc/pinball/${APPLICATION}.env.sh" 23 | export XDG_RUNTIME_DIR 24 | if [ ! -f "$PIDFILE" ]; then 25 | while ! pidof weston > /dev/null ; do 26 | sleep 1 27 | [ 0 -lt $attempts ] || break; 28 | count=$(expr -1 + $attempts) 29 | done 30 | if pidof weston > /dev/null ; then 31 | sleep 1 # TODO: workaround 32 | nohup "$BINFILE" 0<&- &> $LOGFILE & 33 | echo $! > "$PIDFILE" 34 | fi 35 | fi 36 | [ -f "$PIDFILE" ] && echo "done." || echo "fail." 37 | ;; 38 | 39 | stop) 40 | echo -n "Stopping ${APPLICATION} service: " 41 | if [ -f "$PIDFILE" ] ; then 42 | killproc "$BINFILE" 43 | sleep 1 # TODO: workaround it not killed 44 | pidof "$BINFILE" && killall -9 "$APPLICATION" ||: 45 | rm "$PIDFILE" 46 | fi 47 | [ ! -f "$PIDFILE" ] && echo "done." || echo "fail." 48 | ;; 49 | 50 | restart) 51 | "$0" stop 52 | sleep 1 53 | "$0" start 54 | ;; 55 | 56 | status) 57 | status "${APPLICATION}" 58 | ;; 59 | 60 | *) 61 | echo "Usage: $SCRIPTNAME {start|stop|restart|status}" 62 | exit 1 63 | ;; 64 | esac 65 | 66 | exit 0 67 | -------------------------------------------------------------------------------- /test/alpha.cpp: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | Simple test. A cube should be visible in the middle of the screen. 3 | The arrow keys rotates the cube. 4 | ***************************************************************************/ 5 | 6 | #include "Engine.h" 7 | #include "Camera.h" 8 | #include "Cube.h" 9 | #include "KeyRotBehavior.h" 10 | #include "KeyBehavior.h" 11 | #include "Keyboard.h" 12 | #include "Polygon.h" 13 | 14 | /** 15 | * Main 16 | */ 17 | int main(int argc, char *argv[]) { 18 | cerr << "Simple emilia test." << endl; 19 | 20 | // Create the engine. 21 | Engine* engine = new Engine(argc, argv); 22 | engine->setLightning(0.7f, 0.2f); 23 | 24 | // Add a camera. Move a bit. 25 | Camera* camera = new Camera(); 26 | Group* groupCamera = new Group(); 27 | engine->add(groupCamera); 28 | groupCamera->setCamera(camera); 29 | groupCamera->setTranslation(0, 0, 3); 30 | engine->setEngineCamera(groupCamera); 31 | // Add three cubes. 32 | Cube* cubeA = new Cube(1.0, 1.0, 1.0, 1.0, 1.0); 33 | Group* groupCubeA = new Group(); 34 | engine->add(groupCubeA); 35 | groupCubeA->addShape3D(cubeA); 36 | groupCubeA->setTranslation(0, 0, -2); 37 | 38 | Cube* cubeB = new Cube(1.0, 1.0, 0.0, 0.0, 0.3); 39 | cubeB->setProperty(EM_SHAPE3D_TRANS); 40 | Group* groupCubeB = new Group(); 41 | engine->add(groupCubeB); 42 | groupCubeB->addShape3D(cubeB); 43 | 44 | Cube* cubeC = new Cube(1.0, 0.0, 0.0, 1.0, 0.3); 45 | cubeC->setProperty(EM_SHAPE3D_TRANS); 46 | Group* groupCubeC = new Group(); 47 | engine->add(groupCubeC); 48 | groupCubeC->addShape3D(cubeC); 49 | 50 | // Add a behavior to the cubes 51 | KeyRotBehavior* keyRBeh = new KeyRotBehavior(); 52 | groupCubeB->addBehavior(keyRBeh); 53 | 54 | KeyBehavior* keyBeh = new KeyBehavior(); 55 | groupCubeA->addBehavior(keyBeh); 56 | 57 | while (!Keyboard::isKeyDown(SDLK_ESCAPE)) { 58 | engine->tick(); 59 | engine->render(); 60 | engine->swap(); 61 | } 62 | delete(engine); 63 | return 0; 64 | } 65 | -------------------------------------------------------------------------------- /test/anim.cpp: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | Simple test. A cube should be visible in the middle of the screen. 3 | The arrow keys rotates the cube. 4 | ***************************************************************************/ 5 | 6 | #include "Engine.h" 7 | #include "Camera.h" 8 | #include "Cube.h" 9 | #include "Keyboard.h" 10 | #include "StdAnimation.h" 11 | #include "Grid.h" 12 | 13 | /** 14 | * Main 15 | */ 16 | int main(int argc, char *argv[]) { 17 | cerr << "Simple emilia test." << endl; 18 | 19 | // Create the engine. 20 | Engine* engine = new Engine(argc, argv); 21 | engine->setLightning(0.5f, 0.1f); 22 | 23 | // Add a camera. Add some animiation to the camera. 24 | Group* groupC1 = new Group(); 25 | Group* groupC2 = new Group(); 26 | Group* groupC3 = new Group(); 27 | Group* groupC4 = new Group(); 28 | 29 | engine->add(groupC1); 30 | groupC1->add(groupC2); 31 | groupC2->add(groupC3); 32 | groupC3->add(groupC4); 33 | 34 | Cube* cube2 = new Cube(1.0, 1, 1, 0, 1); 35 | groupC2->addShape3D(cube2); 36 | groupC2->setTranslation(0, 0, 2); 37 | 38 | Cube* cube3 = new Cube(1.0, 0, 1, 1, 1); 39 | groupC3->addShape3D(cube3); 40 | groupC3->setTranslation(0, 0, 2); 41 | 42 | Camera* camera = new Camera(); 43 | groupC4->setCamera(camera); 44 | groupC4->setTranslation(0, 1, 2); 45 | engine->setEngineCamera(groupC4); 46 | 47 | Grid* grid = new Grid(NULL, 10, 10, 1, 0, 1, 1, 1, 1); 48 | engine->addShape3D(grid); 49 | 50 | StdAnimation* anim1 = new StdAnimation(60, EM_ROTATION); 51 | anim1->add(0,0,0); 52 | anim1->add(0.25,0.5,0); 53 | anim1->setEnd(0,1,0); 54 | groupC1->addBehavior(anim1); 55 | 56 | StdAnimation* anim3 = new StdAnimation(40, EM_TRANSLATION); 57 | anim3->add(0, 0, 2); 58 | anim3->add(0, 0, 4); 59 | anim3->setEnd(0, 0, 2); 60 | groupC3->addBehavior(anim3); 61 | 62 | while (!Keyboard::isKeyDown(SDLK_ESCAPE)) { 63 | engine->tick(); 64 | engine->render(); 65 | engine->swap(); 66 | } 67 | delete(engine); 68 | return 0; 69 | } 70 | -------------------------------------------------------------------------------- /src/EyeBehavior.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | EyeBehavior.h - description 3 | ------------------- 4 | begin : Wed Jan 26 2000 5 | copyright : (C) 2000 by Henrik Enqvist 6 | email : henqvist@excite.com 7 | ***************************************************************************/ 8 | 9 | #ifndef EYEBEHAVIOR_H 10 | #define EYEBEHAVIOR_H 11 | 12 | #include "Behavior.h" 13 | #include "StateMachine.h" 14 | 15 | // locked view 16 | #define TX0 -1.75f 17 | #define TY0 40.0f 18 | #define TZ0 40.0f 19 | #define RX0 0.15f 20 | #define RY0 0.0f 21 | #define RZ0 0.0f 22 | 23 | // soft pan & scan view 24 | #define TX1 -1.75f 25 | #define TY1 35.0f 26 | #define TZ1 37.0f 27 | #define RX1 0.14f 28 | #define RY1 0.0f 29 | #define RZ1 0.0f 30 | 31 | // moving pan & scan view 32 | #define TX2 -1.75f 33 | #define TY2 32.0f 34 | #define TZ2 34.0f 35 | #define RX2 0.14f 36 | #define RY2 0.0f 37 | #define RZ2 0.0f 38 | 39 | // top view 40 | #define TX3 -1.75f 41 | #define TY3 40.0f 42 | #define TZ3 10.0f 43 | #define RX3 0.23f 44 | #define RY3 0.0f 45 | #define RZ3 0.0f 46 | 47 | // full view 48 | #define TX4 0.f 49 | #define TY4 70.05f ///< With ratio:0.384 for 0.75 screen (768x1024) 50 | #define TZ4 0.0f 51 | #define RX4 0.25f 52 | #define RY4 0.0f 53 | #define RZ4 0.0f 54 | 55 | class Score; 56 | 57 | /** 58 | *

A Behavior for the pinball demo.

59 | */ 60 | class EyeBehavior : public Behavior { 61 | public: 62 | EyeBehavior(); 63 | ~EyeBehavior(); 64 | void onTick(); 65 | void StdOnSignal(); 66 | void StdOnCollision() { EmAssert(false, "EyeBehavior::StdOnCollision() not implemented"); }; 67 | inline void setSound(int s) { m_iSound = s; }; 68 | private: 69 | int m_iNudgeTick; 70 | int m_iNudgeType; 71 | int m_iTiltTick; 72 | float m_fXNudge; 73 | float m_fZNudge; 74 | int m_iSound; 75 | bool m_bTilt; 76 | bool m_bFButton; 77 | }; 78 | 79 | #endif // EYEBEHAVIOR_H 80 | -------------------------------------------------------------------------------- /src/Score.h: -------------------------------------------------------------------------------- 1 | //#ident "$Id: Score.h,v 1.15 2003/06/11 13:25:51 rzr Exp $" 2 | /*************************************************************************** 3 | Score.h - description 4 | ------------------- 5 | begin : Fri Jan 26 2001 6 | copyright : (C) 2001 by Henrik Enqvist 7 | email : henqvist@excite.com 8 | ***************************************************************************/ 9 | 10 | 11 | #ifndef SCORE_H 12 | #define SCORE_H 13 | 14 | #include "Behavior.h" 15 | #include "StateMachine.h" 16 | 17 | class EmFont; 18 | 19 | /* 20 | #define STATE_STOPPED 1 21 | #define STATE_RUNNING 2 22 | #define STATE_TILT 3 23 | #define STATE_WARNING 4 24 | */ 25 | 26 | /** @author Henrik Enqvist */ 27 | class Score : public Behavior { 28 | public: 29 | Score(); 30 | ~Score(); 31 | //static Score* getInstance(); 32 | void onTick(); 33 | void StdOnSignal(); 34 | void StdOnCollision() {}; 35 | int getScore() { return m_iScore; }; 36 | /* void addScore(int s, bool multi = false); */ 37 | void addScore(int s) { m_iScore += s; }; 38 | void clear(); 39 | void draw(); 40 | void setText1(const char * text); 41 | void setText2(const char * text); 42 | void setText3(const char * text); 43 | void setText4(const char * text); 44 | void setInfoText(const char * text, int delay); 45 | void clearText(); 46 | void setShowFPS(bool fps) { m_bShowFPS = fps; }; 47 | bool getShowFPS() { return m_bShowFPS; }; 48 | /* void setMultiplier(int m) { m_iFactor = m; }; */ 49 | /* int getMultiplier() { return m_iFactor; }; */ 50 | 51 | bool testForHighScore(); 52 | 53 | private: 54 | char m_Text1[64]; 55 | char m_Text2[64]; 56 | char m_Text3[64]; 57 | char m_Text4[64]; 58 | char m_InfoText[64]; 59 | int m_iInfoDelay; 60 | bool m_bShowFPS; 61 | int m_iScore; 62 | EmFont * m_Font; 63 | //static Score* p_Score; 64 | 65 | bool m_bExtraBall; 66 | int m_iHiScore; 67 | }; 68 | 69 | #endif // SCORE_H 70 | -------------------------------------------------------------------------------- /test/trans.cpp: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | Transparency test. 3 | ***************************************************************************/ 4 | 5 | #include 6 | 7 | #include "Private.h" 8 | #include "Engine.h" 9 | #include "Camera.h" 10 | #include "Cube.h" 11 | #include "KeyRotBehavior.h" 12 | #include "KeyBehavior.h" 13 | #include "Keyboard.h" 14 | #include "Light.h" 15 | #include "Polygon.h" 16 | 17 | /** Main */ 18 | int main(int argc, char *argv[]) { 19 | cerr << "Simple emilia test." << endl; 20 | 21 | // create the engine. 22 | Engine* engine = new Engine(argc, argv); 23 | engine->setLightning(0.5f, 0.1f); 24 | 25 | // add a camera. Move a bit. 26 | Camera* camera = new Camera(); 27 | Group* groupCamera = new Group(); 28 | engine->add(groupCamera); 29 | groupCamera->setCamera(camera); 30 | groupCamera->setTranslation(0, 0, 3); 31 | engine->setEngineCamera(groupCamera); 32 | 33 | // add cubes 34 | Cube* cube1 = new Cube(1.0f, 1.0f, 0.0f, 0.0f, 0.5f); 35 | Cube* cube2 = new Cube(1.0f, 0.0f, 0.0f, 1.0f, 0.5f); 36 | Group* groupCube1 = new Group(); 37 | Group* groupCube2 = new Group(); 38 | engine->add(groupCube1); 39 | engine->add(groupCube2); 40 | groupCube1->addShape3D(cube1); 41 | groupCube2->addShape3D(cube2); 42 | cube1->setPolygonProperty(EM_POLY_TRANS); 43 | cube1->setProperty(EM_SHAPE3D_USE_TRANS); 44 | cube2->setPolygonProperty(EM_POLY_TRANS); 45 | cube2->setProperty(EM_SHAPE3D_USE_TRANS); 46 | 47 | // add behaviors to the cubes 48 | KeyRotBehavior* keyRBeh = new KeyRotBehavior(); 49 | groupCube1->setBehavior(keyRBeh); 50 | KeyBehavior* keyBeh = new KeyBehavior(); 51 | groupCube2->setBehavior(keyBeh); 52 | 53 | engine->resetTick(); 54 | while (!Keyboard::isKeyDown(SDLK_ESCAPE)) { 55 | if (engine->nextTick()) { 56 | engine->tick(); 57 | } else { 58 | engine->render(); 59 | engine->swap(); 60 | } 61 | } 62 | engine->stopEngine(); 63 | return 0; 64 | } 65 | 66 | #if EM_USE_ALLEGRO 67 | END_OF_MAIN(); 68 | #endif 69 | -------------------------------------------------------------------------------- /test/light.cpp: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | Simple test. A cube should be visible in the middle of the screen. 3 | The arrow keys rotates the cube. 4 | ***************************************************************************/ 5 | 6 | #include 7 | 8 | #include "Private.h" 9 | #include "Engine.h" 10 | #include "Camera.h" 11 | #include "BigSphere.h" 12 | #include "KeyRotBehavior.h" 13 | #include "Keyboard.h" 14 | #include "Light.h" 15 | #include "Polygon.h" 16 | #include "Shape3D.h" 17 | 18 | /** Main */ 19 | int main(int argc, char *argv[]) { 20 | cerr << "Simple emilia test." << endl; 21 | 22 | // Create the engine. 23 | Engine* engine = new Engine(argc, argv); 24 | engine->setLightning(0.5f, 0.0f); 25 | 26 | // Add a camera. Move it a bit. 27 | Camera* camera = new Camera(); 28 | Group* groupCamera = new Group(); 29 | engine->add(groupCamera); 30 | groupCamera->setCamera(camera); 31 | groupCamera->setTranslation(0, 0, 3); 32 | engine->setEngineCamera(groupCamera); 33 | // Add a sphere 34 | BigSphere* sphere = new BigSphere(1, 3, 1, 1, 1, 1); 35 | sphere->setProperty(EM_SHAPE3D_SPECULAR); 36 | Group* groupSphere = new Group(); 37 | engine->add(groupSphere); 38 | groupSphere->addShape3D(sphere); 39 | // Add a light 40 | BigSphere* li = new BigSphere(1, 0, 1, 1, 1, 1); 41 | li->setProperty(EM_SHAPE3D_ALWAYSLIT); 42 | Light* lightR = new Light(2, 0, 0, 1, 0, 0); 43 | Group* groupLightR1 = new Group(); 44 | Group* groupLightR2 = new Group(); 45 | engine->add(groupLightR1); 46 | groupLightR1->add(groupLightR2); 47 | groupLightR2->addShape3D(li); 48 | groupLightR2->setLight(lightR); 49 | groupLightR2->setTranslation(10, 0, 0); 50 | engine->addLight(lightR); 51 | 52 | 53 | // Add a behavior to the light 54 | KeyRotBehavior* keyRBeh = new KeyRotBehavior(); 55 | groupLightR1->setBehavior(keyRBeh); 56 | 57 | while (!Keyboard::isKeyDown(SDLK_ESCAPE)) { 58 | engine->tick(); 59 | engine->render(); 60 | engine->swap(); 61 | // SDL_Delay(50); 62 | } 63 | engine->stopEngine(); 64 | return 0; 65 | } 66 | 67 | #if EM_USE_ALLEGRO 68 | END_OF_MAIN(); 69 | #endif 70 | -------------------------------------------------------------------------------- /src/Script.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | Script.h - description 3 | ------------------- 4 | begin : Sat Aug 24 2002 5 | copyright : (C) 2002 by Henrik Enqvist 6 | email : henqvist@excite.com 7 | ***************************************************************************/ 8 | 9 | #ifndef SCRIPT_H 10 | #define SCRIPT_H 11 | 12 | #include 13 | #include 14 | 15 | #include "Pinball.h" 16 | #include "Behavior.h" 17 | #include "StateMachine.h" 18 | 19 | #define EM_SCRIPT_ONSIGNAL 1 20 | #define EM_SCRIPT_IFVAR 2 21 | #define EM_SCRIPT_SENDSIGNAL 3 22 | #define EM_SCRIPT_SETVAR 4 23 | #define EM_SCRIPT_PLAYSOUND 5 24 | 25 | /** A query item for the scripting engine. */ 26 | class QueryItem { 27 | public: 28 | QueryItem() { 29 | m_iQuery = -1; 30 | m_iAction = -1; 31 | }; 32 | ~QueryItem() {}; 33 | void setQuery(int q) { m_iQuery = q; }; 34 | void setAction(int a) { m_iAction = a; }; 35 | void addQueryParm(int p) { m_vQueryParm.push_back(p); }; 36 | void addActionParm(int p) { m_vActionParm.push_back(p); }; 37 | 38 | int m_iQuery; 39 | int m_iAction; 40 | vector m_vQueryParm; 41 | vector m_vActionParm; 42 | }; 43 | 44 | /** A scripting engine. */ 45 | class Script : public Behavior { 46 | public: 47 | Script() { 48 | this->setType(PBL_TYPE_SCRIPTBEH); 49 | }; 50 | ~Script() {}; 51 | void onTick() {}; 52 | void onSignal(int signal, Group* group); 53 | void StdOnCollision() {}; 54 | void addQueryItem(QueryItem * qi) { m_vQueryItem.push_back(qi); }; 55 | /** Set variable with identifier 'i' to the value of 'v'. If no variable 56 | * exist a new will be created. */ 57 | void setVariable(int i, int v); 58 | /** Returns the vaule of variable 'i'. If no variable exist it returns 0. */ 59 | int getVariable(int i); 60 | void interpret(QueryItem * queryitem, int signal, Group * group); 61 | void execute(QueryItem * queryitem); 62 | 63 | vector m_vQueryItem; 64 | map m_hVariable; 65 | }; 66 | 67 | #endif // SCRIPT_H 68 | -------------------------------------------------------------------------------- /base/Light.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | Light.h - description 3 | ------------------- 4 | begin : Sun Jan 30 2000 5 | copyright : (C) 2000 by 6 | email : 7 | ***************************************************************************/ 8 | 9 | #ifndef LIGHT_H 10 | #define LIGHT_H 11 | 12 | #define EM_IGNORE_ANGLE_HALF 1 13 | #define EM_IGNORE_ANGLE_FULL 2 14 | #define EM_IGNORE_DISTANCE 4 15 | #define EM_USE_BOUNDS 8 16 | #define EM_USE_SPECULAR 16 17 | #define EM_USE_DIFFUSE 32 18 | 19 | class Group; 20 | 21 | #include "Node.h" 22 | /** Example: 23 | *
24 |  * Group* groupL = new group;
25 |  * Light* l = new Light(1.0, 10.0);
26 |  * 
27 |  * groupL->setLight(l);
28 |  * engine->add(groupL);
29 |  * 
30 |  * engine->addLight(l);
31 |  * 
*/ 32 | class Light { 33 | public: 34 | /** Light(constant, linear, quadratic, r, g, b). */ 35 | Light(float c, float l, float q, float r=1.0, float g=1.0, float b=1.0); 36 | ~Light(); 37 | void setOn(bool on=true) { m_bOn = on;}; 38 | bool getOn() { return m_bOn;}; 39 | // TODO fast clamp 40 | inline void setColor(float r, float g, float b) { 41 | m_fR = EM_MAX(EM_MIN(1.0, r), 0.0); 42 | m_fG = EM_MAX(EM_MIN(1.0, g), 0.0); 43 | m_fB = EM_MAX(EM_MIN(1.0, b), 0.0); 44 | }; 45 | void getColor(float & r, float & g, float & b) { r = m_fR; g = m_fG; b = m_fB; }; 46 | void setProperty(int); 47 | void unsetProperty(int); 48 | void setBounds(float b) { m_fBounds = b; }; 49 | void setIndex(int i); 50 | inline Group * getParent() { 51 | return p_Parent; 52 | }; 53 | 54 | Vertex3D m_vtxSrc; 55 | Vertex3D m_vtxTrans; 56 | Vertex3D m_vtxAlign; 57 | private: 58 | friend class AmbientLightVisitor; 59 | friend class TransformVisitor; 60 | friend class Group; 61 | 62 | void setParent(Group * p) { 63 | p_Parent = p; 64 | }; 65 | Group * p_Parent; 66 | float m_fConstant; 67 | float m_fLinear; 68 | float m_fQuadratic; 69 | float m_fR, m_fG, m_fB; 70 | float m_fBounds; 71 | bool m_bOn; 72 | int m_iProperties; 73 | }; 74 | 75 | #endif // LIGHT_H 76 | -------------------------------------------------------------------------------- /test/ship.emi: -------------------------------------------------------------------------------- 1 | shp { 2 | vts { 8 } 3 | pls { 12 } 4 | vtx { -0.5 -1.0 0.0 } 5 | vtx { -0.5 1.0 -0.7 } 6 | vtx { -1.5 1.0 0.0 } 7 | vtx { 0.5 -1.0 0.0 } 8 | vtx { 0.5 1.0 -0.7 } 9 | vtx { 1.5 1.0 0.0 } 10 | vtx { -0.5 1.3000001 0.0 } 11 | vtx { 0.5 1.3000001 0.0 } 12 | ply { 13 | pes { 3 } 14 | ple { 1 0.0 0.0 1.0 1.0 1.0 1.0 } 15 | ple { 2 0.0 0.0 1.0 1.0 1.0 1.0 } 16 | ple { 0 0.0 0.0 1.0 1.0 1.0 1.0 } 17 | } 18 | ply { 19 | pes { 3 } 20 | ple { 0 0.0 0.0 1.0 1.0 1.0 1.0 } 21 | ple { 3 0.0 0.0 1.0 1.0 1.0 1.0 } 22 | ple { 1 0.0 0.0 1.0 1.0 1.0 1.0 } 23 | } 24 | ply { 25 | pes { 3 } 26 | ple { 3 0.0 0.0 1.0 1.0 1.0 1.0 } 27 | ple { 4 0.0 0.0 1.0 1.0 1.0 1.0 } 28 | ple { 1 0.0 0.0 1.0 1.0 1.0 1.0 } 29 | } 30 | ply { 31 | pes { 3 } 32 | ple { 5 0.0 0.0 1.0 1.0 1.0 1.0 } 33 | ple { 4 0.0 0.0 1.0 1.0 1.0 1.0 } 34 | ple { 3 0.0 0.0 1.0 1.0 1.0 1.0 } 35 | } 36 | ply { 37 | pes { 3 } 38 | ple { 6 0.0 0.0 1.0 1.0 1.0 1.0 } 39 | ple { 2 0.0 0.0 1.0 1.0 1.0 1.0 } 40 | ple { 1 0.0 0.0 1.0 1.0 1.0 1.0 } 41 | } 42 | ply { 43 | pes { 3 } 44 | ple { 7 0.0 0.0 1.0 1.0 1.0 1.0 } 45 | ple { 4 0.0 0.0 1.0 1.0 1.0 1.0 } 46 | ple { 5 0.0 0.0 1.0 1.0 1.0 1.0 } 47 | } 48 | ply { 49 | pes { 3 } 50 | ple { 1 0.0 0.0 1.0 1.0 1.0 1.0 } 51 | ple { 4 0.0 0.0 1.0 1.0 1.0 1.0 } 52 | ple { 6 0.0 0.0 1.0 1.0 1.0 1.0 } 53 | } 54 | ply { 55 | pes { 3 } 56 | ple { 6 0.0 0.0 1.0 1.0 1.0 1.0 } 57 | ple { 4 0.0 0.0 1.0 1.0 1.0 1.0 } 58 | ple { 7 0.0 0.0 1.0 1.0 1.0 1.0 } 59 | } 60 | ply { 61 | pes { 3 } 62 | ple { 0 0.0 0.0 1.0 1.0 1.0 1.0 } 63 | ple { 2 0.0 0.0 1.0 1.0 1.0 1.0 } 64 | ple { 6 0.0 0.0 1.0 1.0 1.0 1.0 } 65 | } 66 | ply { 67 | pes { 3 } 68 | ple { 6 0.0 0.0 1.0 1.0 1.0 1.0 } 69 | ple { 7 0.0 0.0 1.0 1.0 1.0 1.0 } 70 | ple { 0 0.0 0.0 1.0 1.0 1.0 1.0 } 71 | } 72 | ply { 73 | pes { 3 } 74 | ple { 3 0.0 0.0 1.0 1.0 1.0 1.0 } 75 | ple { 0 0.0 0.0 1.0 1.0 1.0 1.0 } 76 | ple { 7 0.0 0.0 1.0 1.0 1.0 1.0 } 77 | } 78 | ply { 79 | pes { 3 } 80 | ple { 3 0.0 0.0 1.0 1.0 1.0 1.0 } 81 | ple { 7 0.0 0.0 1.0 1.0 1.0 1.0 } 82 | ple { 5 0.0 0.0 1.0 1.0 1.0 1.0 } 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /addon/TexAnimation.cpp: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | TexAnimation.cpp - description 3 | ------------------- 4 | begin : Wed Jan 26 2000 5 | copyright : (C) 2000 by Henrik Enqvist 6 | email : henqvist@excite.com 7 | ***************************************************************************/ 8 | 9 | #include "Private.h" 10 | #include "TexAnimation.h" 11 | #include "Group.h" 12 | #include "math.h" 13 | #include "Light.h" 14 | #include "BillBoard.h" 15 | 16 | TexAnimation::TexAnimation(int step, int nvtx) : Behavior() { 17 | EmAssert(nvtx > 0, "TexAnimation::TexAnimation nvtx less than 1"); 18 | m_iStep = step; 19 | m_iTick = 0; 20 | m_iTexCoord = nvtx; 21 | } 22 | 23 | TexAnimation::~TexAnimation() { 24 | } 25 | 26 | void TexAnimation::add(float u, float v) { 27 | TexCoord tex; 28 | tex.u = u; 29 | tex.v = v; 30 | m_vTexCoord.push_back(tex); 31 | } 32 | 33 | void TexAnimation::onTick() { 34 | EmAssert(this->getParent() != NULL, "Parent not allowed to be null"); 35 | 36 | float sU, sV, eU, eV, u, v; 37 | int size = (int)(m_vTexCoord.size()/m_iTexCoord); 38 | 39 | if (m_iTick >= size*m_iStep) { 40 | m_iTick = 0; 41 | } 42 | 43 | int index = (int)(m_iTick/m_iStep); 44 | 45 | // TODO this mtherfcker will crash !!! 46 | for (int a=0; agetParent()->getBillBoard(); 67 | if (b != NULL) { 68 | b->setUV(u, v, a); 69 | EM_COUT("TexAnimation::onTick() " << u <<" "<< v <<" size "<< size <<" index "<< 70 | index <<" tick "<< m_iTick, 0); 71 | } 72 | } 73 | 74 | m_iTick++; 75 | } 76 | 77 | -------------------------------------------------------------------------------- /pinball.spec: -------------------------------------------------------------------------------- 1 | Name: pinball 2 | Version: 0.3.1 3 | Release: 1rh90 4 | 5 | Group: Amusements/Games 6 | Summary: Emilia Pinball is free OpenGL pinball game. 7 | 8 | Vendor: Henrik Enqvist 9 | Packager: Henrik Enqvist 10 | License: GPL 11 | URL: http://pinball.sourceforge.net 12 | Source: http://prdownloads.sourceforge.net/pinball/%{name}-%{version}.tar.gz 13 | Source1: %{name}.desktop 14 | BuildRoot: %{_tmppath}/%{name}-%{version}-root 15 | 16 | %description 17 | Pinball game. 18 | 19 | 20 | %prep 21 | rm -rf %{buildroot} 22 | 23 | %setup -n %{name}-%{version} 24 | 25 | %build 26 | ./configure --prefix=%{_prefix} --with-highscore-prefix=/var/lib/games/pinball 27 | make 28 | 29 | 30 | %install 31 | make DESTDIR=%{buildroot} install 32 | 33 | #Install application link for X-Windows 34 | mkdir -p %{buildroot}%{_datadir}/applications 35 | desktop-file-install --vendor=emilia \ 36 | --dir %{buildroot}%{_datadir}/applications \ 37 | --add-category X-Red-Hat-Extra \ 38 | --add-category Application \ 39 | --add-category Game \ 40 | %{SOURCE1} 41 | 42 | 43 | %clean 44 | rm -rf %{buildroot} 45 | 46 | %files 47 | %defattr(-,root,root) 48 | %doc AUTHORS COPYING INSTALL NEWS README 49 | %{_prefix}/bin/pinball 50 | %{_prefix}/bin/pinball-config 51 | %dir %{_prefix}/share/pinball 52 | %{_prefix}/share/pinball/* 53 | %dir %{_prefix}/lib/pinball 54 | %{_prefix}/lib/pinball/* 55 | %dir %{_prefix}/include/pinball 56 | %{_prefix}/include/pinball/* 57 | %{_prefix}/share/applications/*.desktop 58 | %attr(0775, root, root) %dir /var/lib/games/pinball 59 | %attr(0666, games, games) %dir /var/lib/games/pinball/professor/highscores 60 | %attr(0666, games, games) %dir /var/lib/games/pinball/tux/highscores 61 | 62 | 63 | %changelog 64 | * Mon Apr 07 2003 Michal Ambroz (O_O) 65 | - rebuild for Fedora Core 1 66 | * Mon Apr 07 2003 Michal Ambroz (O_O) 67 | - cleanup for RHL 9 68 | * Wed Mar 05 2003 Henrik Enqvist 69 | - removed build_root to make it work with libtool (ugly) 70 | * Fri Mar 08 2002 Michal Ambroz (O_O) 71 | - initial pinball RPM 72 | -------------------------------------------------------------------------------- /extra/Makefile: -------------------------------------------------------------------------------- 1 | #!/usr/bin/make -f 2 | # -*- makefile -*- 3 | # ex: set tabstop=4 noexpandtab: 4 | # -*- coding: utf-8 -* 5 | # 6 | # SPDX-License-Identifier: GPL-2.0-or-later 7 | # Copyright: Philippe Coval - 2020+ 8 | # 9 | 10 | project?=pinball 11 | V?=1 12 | 13 | machine?=generic 14 | architecture?=i386 15 | 16 | mirror?=https://deb.debian.org/debian 17 | scratchsize?=4G 18 | suite?=bullseye 19 | 20 | flags?=-v 21 | flags+=--scratchsize=${scratchsize} 22 | flags+=-tsuite:${suite} 23 | flags+=-tmirror:${mirror} 24 | 25 | images_lists ?= ${project}-i386-generic.img 26 | images_lists += ${project}-amd64-generic.img 27 | 28 | topdir?=.. 29 | sudo?=sudo 30 | 31 | 32 | default: help all 33 | @echo "# $@: @^" 34 | 35 | help: Makefile 36 | @echo "## Usage:" 37 | @echo "# ${Only for internal use.

15 | *

Description.

16 | *

Class visitor is base class for all visitors.

17 | *

The purpose of Visitors are the decouple structure form functionality. 18 | * The structure is represented by objets like Groups Lights Shape3DS etc, 19 | * these objects only include information of the specific object ( the data). 20 | * The functionality for manipulation the objets is found found 21 | * in the Visitor objects.

22 | *

For example the code in the Shape3D class should only deal with 23 | * storing data for vertices, polygons, colors and textures. 24 | * The Shape3D class has no functions for drawing its 25 | * context to the screen. The drawing functionality is encapsulated in the 26 | * RenderVisitor class.

27 | *

Implementation.

28 | *

Visitors are traversed through the context tree ( the engine and 29 | * all its groups ) to perform a specific task on the objects in the tree. 30 | * For example transformin vertices, drawing to the screen, collision 31 | * detection.

32 | *

Traversing is done by calling the 'accept' function of 33 | * the Group with the Visitor as a parameter. The Group calls the 34 | * Visitors 'visit' funtion with itself as parameter. The visitor performs 35 | * its functionality on the Group. The Group has now been transformed, draw 36 | * or w.

37 | *

The Group then calls all its 38 | * childrens ( Groups, Shape3Ds ... ) 'accept' function with the same 39 | * Visitor as parameter. Then children.

40 | * 41 | * @see AlignVisitor 42 | * @see AnimationVisitor 43 | * @see BehaviorVisitor 44 | * @see CollisionVisitor 45 | * @see GLightVisitor 46 | * @see PNormalVisitor 47 | * @see VNormalVisitor 48 | */ 49 | class Visitor { 50 | public: 51 | Visitor(){}; 52 | virtual ~Visitor(){}; 53 | virtual void visit(Group*){}; 54 | virtual void empty(){}; 55 | }; 56 | 57 | #endif // VISITOR_H 58 | -------------------------------------------------------------------------------- /base/StateMachine.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | StateMachine.h - description 3 | ------------------- 4 | begin : Fri Jul 13 2001 5 | copyright : (C) 2001 by Henrik Enqvist IB 6 | email : henqvist@excite.com 7 | ***************************************************************************/ 8 | 9 | #ifndef STATEMACHINE_H 10 | #define STATEMACHINE_H 11 | 12 | #include "SignalSender.h" 13 | /* Macros to do a state machine */ 14 | 15 | #define StdOnCollision() \ 16 | onCollision(const Vertex3D & em_vtx, const Vertex3D & em_vtxOwn, Group* em_group) 17 | 18 | #define StdEmptyOnCollision() \ 19 | onCollision(const Vertex3D &, const Vertex3D &, Group*) 20 | 21 | #define StdOnSignal() \ 22 | onSignal(int em_signal, Group* em_group) 23 | 24 | #define StdEmptyOnSignal() \ 25 | onSignal(int, Group*) 26 | 27 | #define StdOnTick() \ 28 | onTick() 29 | 30 | #define OnCallerProperty(a) \ 31 | if ( em_group != NULL && ( em_group->getUserProperties() & a ) ) 32 | 33 | #define GetCallerProperty() \ 34 | em_group->getUserProperties() 35 | 36 | #define OR_CP \ 37 | || em_group->getUserProperties() & 38 | 39 | #define AND_CP \ 40 | && em_group->getUserProperties() & 41 | 42 | #define OnProperty(a) \ 43 | if ( p_Parent != NULL && ( p_Parent->getUserProperties() & a ) ) 44 | 45 | #define SetProperty(a) \ 46 | if ( p_Parent != NULL ) p_Parent->setUserProperty(a) 47 | 48 | #define UnsetProperty(a) \ 49 | if ( p_Parent != NULL ) p_Parent->unsetUserProperty(a) 50 | 51 | #define OR_PR \ 52 | || p_Parent->getUserProperties() & 53 | 54 | #define AND_PR \ 55 | && p_Parent->getUserProperties() & 56 | 57 | /* #define OnState(a) if ( m_iState == a ) */ 58 | /* #define OR_ST || m_iState == */ 59 | /* #define AND_ST && m_iState == */ 60 | /* #define SetState(a) m_iState = a */ 61 | 62 | #define OnSignal(a) \ 63 | if ( em_signal == a ) 64 | 65 | #define ElseOnSignal(a) \ 66 | else if ( em_signal == a ) 67 | 68 | #define OR_SI \ 69 | || em_signal == 70 | 71 | #define GetSignal() \ 72 | em_signal 73 | //#define AND_SI && em_signal == 74 | 75 | #define SendSignal(a, d, s, r) \ 76 | SignalSender::getInstance()->addSignal(a, d, s, r) 77 | 78 | #define SetLightOn(b) \ 79 | if (this->getLight() != NULL) this->getLight()->setOn(b) 80 | 81 | #endif // STATEMACHINE_H 82 | -------------------------------------------------------------------------------- /src/Script.cpp: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | Script.cpp - description 3 | ------------------- 4 | begin : Wed Jan 26 2000 5 | copyright : (C) 2000 by Henrik Enqvist 6 | email : henqvist@excite.com 7 | ***************************************************************************/ 8 | 9 | #include "Private.h" 10 | #include "Script.h" 11 | #include "Group.h" 12 | #include "Shape3D.h" 13 | 14 | void Script::setVariable(int i, int v) { 15 | map::iterator element = m_hVariable.find(i); 16 | if (element != m_hVariable.end()) { 17 | (*element).second = v; 18 | } else { 19 | m_hVariable.insert(pair(i, v)); 20 | } 21 | } 22 | 23 | int Script::getVariable(int i) { 24 | map::iterator element = m_hVariable.find(i); 25 | if (element != m_hVariable.end()) { 26 | return (*element).second; 27 | } else { 28 | return 0; 29 | } 30 | } 31 | 32 | void Script::interpret(QueryItem * queryitem, int signal, Group * group) { 33 | EmAssert(queryitem != NULL, "Scrip::interpret queryitem NULL"); 34 | 35 | switch (queryitem->m_iQuery) { 36 | case EM_SCRIPT_ONSIGNAL: { 37 | vector::iterator iter = queryitem->m_vQueryParm.begin(); 38 | vector::iterator end = queryitem->m_vQueryParm.end(); 39 | for (; iter != end; ++iter) { 40 | if ((*iter) == signal) { 41 | this->execute(queryitem); 42 | break; 43 | } 44 | } 45 | } break; 46 | } 47 | } 48 | 49 | void Script::execute(QueryItem * queryitem) { 50 | EmAssert(queryitem != NULL, "Script::execute queryitem NULL"); 51 | EmAssert(this->getParent() != NULL, "Script::execute parent NULL"); 52 | 53 | switch (queryitem->m_iAction) { 54 | case EM_SCRIPT_SENDSIGNAL: { 55 | if (queryitem->m_vActionParm.size() > 1) { 56 | SendSignal(queryitem->m_vActionParm[0], queryitem->m_vActionParm[1], this->getParent(), NULL); 57 | } 58 | } break; 59 | case EM_SCRIPT_SETVAR: { 60 | if (queryitem->m_vActionParm.size() > 1) { 61 | this->setVariable(queryitem->m_vActionParm[0], queryitem->m_vActionParm[1]); 62 | } 63 | } break; 64 | } 65 | } 66 | 67 | void Script::onSignal(int signal, Group * group) { 68 | vector::iterator iter = m_vQueryItem.begin(); 69 | vector::iterator end = m_vQueryItem.end(); 70 | for (; iter != end; ++iter) { 71 | this->interpret((*iter), signal, group); 72 | } 73 | } 74 | 75 | -------------------------------------------------------------------------------- /docs/faq.md: -------------------------------------------------------------------------------- 1 | # FAQ # 2 | 3 | Why does the game run so sloooooow? 4 | 5 | 1. Buy a 3D card. 6 | 7 | 2. Check that you have configured your card right, 'glxgears' should run with at least 400 fps on low end machines (300Mhz Voodoo3). Make sure that you have the latest drivers installed. Read the manual for your card or search the web for help. 8 | 9 | 3. Turn off all other applications, yes linux is able of multitasking but some programs may spontaneously start to consume cpu time. 10 | 11 | 4. Turn off music. Your SDL version most likely uses timidity for midi sequencing. Timidity sounds great but uses quite a lot of resources. You may need to restart the game for the sound system to be properly shut down. Sound effects should, however, not affect the frame rate. 12 | 13 | 5. Use smaller screen size, especially with software rendering. 14 | 15 | Will it run on my P166 with a S3 4Mb gfx card? No, you need a fast cpu and prefferable a 3D card. If you want you can try the software-rendering version which uses the Allegro library. 16 | 17 | Is there a level editor? 18 | 19 | Yes. Download the 'pinedit' package at sourceforge. 20 | 21 | Why doesn't the rpms work on Mandrake? 22 | 23 | Mandrake doesn't have libpng.so.2 installed, instead there is a libpng.so.3. To compile the source code should, however, not be any trouble. I noticed that some friendly soul has made some mandrake binaries, you can find them at rpmfind, search with the word pinball. 24 | 25 | Why are the sounds delayed with 0.5 seconds? 26 | 27 | You're either using arts, esd or have buggy audio drivers. Stop arts and esd, if that does not help install alsa drivers. 28 | 29 | Why can't I hear any music even if I hear the sounds? 30 | 31 | The game uses the default midi player of SDL_mixer, 'timidity', which is compiled into SDL_mixer. You can compile SDL_mixer yourself and tell it to use native midi or something. First check that your system is able to play midi files, use 'kmidi', 'timidity' or something. Then you have check that SDL_mixer can play midi files, the name of the program is 'playmus'. 32 | 33 | Things that might fix your problems are: fiddle with the /etc/timidity.cfg file, use latest version of SDL_mixer, compile SDL_mixer yourself, use alsa drivers (I always recommend alsa drivers). I'll give more answers when I know more about what causes these troubles. 34 | 35 | Compiling the editor complaines about moc_* files? 36 | 37 | Your version of QT is different than in the package. Simply delete all moc_* files, they will be regenerated. 38 | -------------------------------------------------------------------------------- /base/CollisionBounds.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | CollisionBounds.h - description 3 | ------------------- 4 | begin : Sun Mar 19 2000 5 | copyright : (C) 2000 by Henrik Enqvist, GPL 6 | email : henqvist@excite.com 7 | ***************************************************************************/ 8 | 9 | #ifndef COLLISIONBOUNDS_H 10 | #define COLLISIONBOUNDS_H 11 | 12 | #include 13 | 14 | #include "EMath.h" 15 | 16 | class Shape3D; 17 | class Polygon3D; 18 | class Group; 19 | 20 | /** */ 21 | class CollisionBounds { 22 | public: 23 | /** CollisionBounds( radius, x, y, z ). 24 | ** radius is the size of the bounds x y z is center of the bounds 25 | ** relative to the center of the group. */ 26 | CollisionBounds(float size, float x=0.0f, float y=0.0f, float z=0.0f); 27 | ~CollisionBounds(); 28 | /** Removes old configuration and adds all polygons to the bounds 29 | * or to its children. Splits the bounds to 'level' amount of levels.*/ 30 | void setShape3D(Shape3D * s, int level); 31 | /** Used by the transform visitor. */ 32 | void transform(const Matrix & mtx); 33 | bool hasShape3D() { return m_bHasShape3D; }; 34 | 35 | private: 36 | friend class Group; 37 | friend class CollisionVisitor; 38 | friend class BoundsRenderVisitor; 39 | friend class AlignVisitor; 40 | friend class OctTree; 41 | 42 | /** Split the polygons in the collsion bound into 8 smaller collision 43 | ** bounds. The new collision will be located at x = oldX +/- 0.25*oldSize, 44 | ** y = oldY +/- 0.25*oldSize and z = oldZ + +/- 0.25*oldSize and the new size 45 | ** will be 0.5*oldSize.

*/ 46 | void split(int level); 47 | int intersect(Polygon3D* p); 48 | void setParent(Group* g); 49 | int surround(Polygon3D* p); 50 | /** Removes empty bounding boxes from the tree of bounding boxes. */ 51 | bool removeEmpty(); 52 | bool addSurround(Polygon3D* p); 53 | void addIntersect(Polygon3D* p); 54 | void printTree(int level=0); 55 | 56 | Vertex3D m_vtxSrc; 57 | Vertex3D m_vtxTrans; 58 | 59 | bool m_bHasShape3D; 60 | Group* p_Parent; 61 | /** BoxSize is for internal use. */ 62 | float m_fBoxSize; 63 | /** You should always use Radius when detection collision */ 64 | float m_fRadius; 65 | vector m_vPolygon; 66 | vector m_vCollisionBounds; 67 | //float m_fR, m_fG, m_fB; 68 | }; 69 | 70 | #endif // COLLISIONBOUNDS_H 71 | -------------------------------------------------------------------------------- /src/Obj3dsUtil.h: -------------------------------------------------------------------------------- 1 | //#ident "$Id: Obj3dsUtil.h,v 1.2 2003/06/13 13:39:48 rzr Exp $" 2 | #ifndef Obj3dsUtil_h_ 3 | #define Obj3dsUtil_h_ 4 | class Shape3D; 5 | class Obj3dsUtil; 6 | class Group; 7 | /** 8 | * @author: www.Philippe.COVAL.online.fr - Rev: $Author: rzr $ 9 | * 3dStudio : 3ds max import / export (Assci) 10 | * Wrap to a rzr's mini-lib (Under devel) 11 | * load 3ds objects (exported to ascii (dos "\r\n" ) .asc) 12 | * Limitations are : polygons are converted to triangles, 13 | * neighbour triangles can't have a different color 14 | * 15 | * Currenly it works this way : 16 | * - To use/test add #define RZR_PATCHES_3DS in ../pinconfig.h 17 | * - To use a full 3ds object with several object textured 18 | * it should possible when separating the .asc in several 19 | * - replace the material line by a texture file ( file.png) 20 | * or a color encoded like : "r255g128b000a128" 21 | * - export may be called when needed 22 | * @see Loader 23 | * 24 | * 3DS .ASC File export example: 25 | 26 | Named object: "Object_0" 27 | Tri-mesh, Vertices: 3 Faces: 1 28 | Vertex list 29 | Vertex 0: X:0 Y:0 Z:0 30 | Vertex 1: X:0 Y:10 Z:0 U:.4 V:.6 (<= optional) 31 | Vertex 2: X:10 Y:10 Z:0 32 | Face list 33 | Face 0: A:3 B:2 C:1 AB:1 BC:1 CA:1 34 | Material:"BLUE (or whatever)" 35 | Smoothing: 1 36 | 37 | **/ 38 | class Obj3dsUtil 39 | { 40 | public: 41 | /// 42 | static Obj3dsUtil* getInstance(); 43 | /// load 3ds objects into one Shape (exported to ascii .asc) 44 | /// multi Raw Colors or ONE SINGLE texture supported 45 | static int read( Shape3D& shape, 46 | char const * const filename = "obj-3ds.asc" ); 47 | /// load objects (as much pinball's shapes as 3ds' trimesh) 48 | /// multi textures or Colors are supported 49 | static int read( Group& in, 50 | char const * const filename = "obj-3ds.asc" ); 51 | /// export to 3ds object, loosy //!!! check 52 | static int write(Shape3D const & shape, char const* const filename ); 53 | /// export to 3ds object, loosy //!!! check 54 | /// @param out : must be allready open as "wb" 55 | static int write(Shape3D const & shape, FILE* out = stdout ); 56 | /// export to 3ds object, loosy //!!! check 57 | static int write( Group & in, char const* const filename ); 58 | /// const 59 | /// @param out : must be allready open as "wb" 60 | static int write( Group & in, FILE* out = stdout); 61 | protected: 62 | /// Singleton design pattern 63 | static Obj3dsUtil* p_Instance; 64 | }; 65 | #endif //_h_ inclusion 66 | //EOF $Id: Obj3dsUtil.h,v 1.2 2003/06/13 13:39:48 rzr Exp $ 67 | -------------------------------------------------------------------------------- /test/tmp.emi: -------------------------------------------------------------------------------- 1 | emilia shape3d 2 | vertices 3 | 24 4 | polygons 5 | 12 6 | start vertices 7 | -4.7 -2.7 7.100001 8 | -4.2999997 3.6 7.100001 9 | -5.0999994 -2.7 2.2000003 10 | -4.6999993 3.6 2.2000003 11 | -4.9999995 -2.7 -1.2999997 12 | -4.5999994 3.6 -1.2999997 13 | -4.6 -2.7 -4.2999997 14 | -4.2 3.6 -4.2999997 15 | -0.80000067 -2.7 -7.2999997 16 | -0.4000001 3.6 -7.2999997 17 | 5.399999 -2.7 -6.7999997 18 | 5.7999997 3.6 -6.7999997 19 | 7.4999995 -2.7 -4.5 20 | 7.9 3.6 -4.5 21 | 7.6999993 -2.7 -1.5000008 22 | 8.099999 3.6 -1.5000008 23 | 7.6999993 -2.7 2.099999 24 | 8.099999 3.6 2.099999 25 | 7.399999 -2.7 6.599999 26 | 7.7999983 3.6 6.599999 27 | 4.1999993 -2.7 10.1 28 | 4.599999 3.6 10.1 29 | -1.5000007 -2.7 9.8 30 | -1.100001 3.6 9.8 31 | end vertices 32 | start polygons 33 | 4 34 | texture ? 35 | 1 0.0 0.0 1.0 1.0 1.0 1.0 36 | 0 0.0 0.0 1.0 1.0 1.0 1.0 37 | 2 0.0 0.0 1.0 1.0 1.0 1.0 38 | 3 0.0 0.0 1.0 1.0 1.0 1.0 39 | 4 40 | texture ? 41 | 2 0.0 0.0 1.0 1.0 1.0 1.0 42 | 4 0.0 0.0 1.0 1.0 1.0 1.0 43 | 5 0.0 0.0 1.0 1.0 1.0 1.0 44 | 3 0.0 0.0 1.0 1.0 1.0 1.0 45 | 4 46 | texture ? 47 | 4 0.0 0.0 1.0 1.0 1.0 1.0 48 | 6 0.0 0.0 1.0 1.0 1.0 1.0 49 | 7 0.0 0.0 1.0 1.0 1.0 1.0 50 | 5 0.0 0.0 1.0 1.0 1.0 1.0 51 | 4 52 | texture ? 53 | 6 0.0 0.0 1.0 0.0 0.0 1.0 54 | 8 0.0 0.0 1.0 0.0 0.0 1.0 55 | 9 0.0 0.0 1.0 0.0 0.0 1.0 56 | 7 0.0 0.0 1.0 0.0 0.0 1.0 57 | 4 58 | texture ? 59 | 8 0.0 0.0 1.0 1.0 1.0 1.0 60 | 10 0.0 0.0 1.0 1.0 1.0 1.0 61 | 11 0.0 0.0 1.0 1.0 1.0 1.0 62 | 9 0.0 0.0 1.0 1.0 1.0 1.0 63 | 4 64 | texture ? 65 | 10 0.0 0.0 1.0 1.0 1.0 1.0 66 | 12 0.0 0.0 1.0 1.0 1.0 1.0 67 | 13 0.0 0.0 1.0 1.0 1.0 1.0 68 | 11 0.0 0.0 1.0 1.0 1.0 1.0 69 | 4 70 | texture ? 71 | 12 0.0 0.0 1.0 1.0 1.0 1.0 72 | 14 0.0 0.0 1.0 1.0 1.0 1.0 73 | 15 0.0 0.0 1.0 1.0 1.0 1.0 74 | 13 0.0 0.0 1.0 1.0 1.0 1.0 75 | 4 76 | texture ? 77 | 14 0.0 0.0 1.0 1.0 1.0 1.0 78 | 16 0.0 0.0 1.0 1.0 1.0 1.0 79 | 17 0.0 0.0 1.0 1.0 1.0 1.0 80 | 15 0.0 0.0 1.0 1.0 1.0 1.0 81 | 4 82 | texture ? 83 | 16 0.0 0.0 1.0 1.0 1.0 1.0 84 | 18 0.0 0.0 1.0 1.0 1.0 1.0 85 | 19 0.0 0.0 1.0 1.0 1.0 1.0 86 | 17 0.0 0.0 1.0 1.0 1.0 1.0 87 | 4 88 | texture ? 89 | 18 0.0 0.0 1.0 1.0 0.0 0.0 90 | 20 0.0 0.0 1.0 1.0 0.0 0.0 91 | 21 0.0 0.0 1.0 1.0 0.0 0.0 92 | 19 0.0 0.0 1.0 1.0 0.0 0.0 93 | 4 94 | texture ? 95 | 20 0.0 0.0 1.0 1.0 0.0 0.0 96 | 22 0.0 0.0 1.0 1.0 0.0 0.0 97 | 23 0.0 0.0 1.0 1.0 0.0 0.0 98 | 21 0.0 0.0 1.0 1.0 0.0 0.0 99 | 4 100 | texture ? 101 | 0 0.0 0.0 1.0 1.0 0.0 0.0 102 | 1 0.0 0.0 1.0 1.0 0.0 0.0 103 | 23 0.0 0.0 1.0 1.0 0.0 0.0 104 | 22 0.0 0.0 1.0 1.0 0.0 0.0 105 | end polygons 106 | -------------------------------------------------------------------------------- /test/texture.cpp: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | Texture test. A cube should be visible in the middle of the screen. 3 | The cube has a texture applied to it. 4 | The arrow keys rotates the cube. 5 | ***************************************************************************/ 6 | 7 | #include 8 | 9 | #include "Private.h" 10 | #include "Engine.h" 11 | #include "Camera.h" 12 | #include "Cube.h" 13 | #include "KeyRotBehavior.h" 14 | #include "KeyBehavior.h" 15 | #include "Keyboard.h" 16 | #include "TextureUtil.h" 17 | #include "Light.h" 18 | #include "Polygon.h" 19 | 20 | /** Main */ 21 | int main(int argc, char *argv[]) { 22 | cerr << "Simple emilia test." << endl; 23 | 24 | if (argc < 2) { 25 | cerr << "Usage: texture " << endl; 26 | return 0; 27 | } 28 | 29 | // Create the engine. 30 | Engine* engine = new Engine(argc, argv); 31 | engine->setLightning(0.5f, 0.1f); 32 | 33 | // Add a camera. Move a bit. 34 | Camera* camera = new Camera(); 35 | Group* groupCamera = new Group(); 36 | engine->add(groupCamera); 37 | groupCamera->setCamera(camera); 38 | groupCamera->setTranslation(0, 0, 3); 39 | engine->setEngineCamera(groupCamera); 40 | 41 | // Load a texture 42 | EmTexture* texture = TextureUtil::getInstance()->loadTexture(argv[1]); 43 | if (texture == NULL) { 44 | cerr << "Error loading texture" << endl; 45 | return -1; 46 | } 47 | 48 | // Add a cube. 49 | Cube* cube1 = new Cube(1.0, texture); 50 | Cube* cube2 = new Cube(1.0, texture); 51 | Group* groupCube1 = new Group(); 52 | Group* groupCube2 = new Group(); 53 | engine->add(groupCube1); 54 | engine->add(groupCube2); 55 | groupCube1->addShape3D(cube1); 56 | groupCube2->addShape3D(cube2); 57 | cube1->setPolygonProperty(EM_POLY_TRANS); 58 | cube1->setProperty(EM_SHAPE3D_USE_TRANS); 59 | 60 | // Add a light 61 | Light* lightR = new Light(1, 0, 0, 1, 0, 0); 62 | Group* groupLightR = new Group(); 63 | engine->add(groupLightR); 64 | groupLightR->setLight(lightR); 65 | groupLightR->setTranslation(5, 0, 0); 66 | engine->addLight(lightR); 67 | 68 | // Add behaviors to the cubes 69 | KeyRotBehavior* keyRBeh = new KeyRotBehavior(); 70 | groupCube1->setBehavior(keyRBeh); 71 | KeyBehavior* keyBeh = new KeyBehavior(); 72 | groupCube2->setBehavior(keyBeh); 73 | 74 | engine->resetTick(); 75 | while (!Keyboard::isKeyDown(SDLK_ESCAPE)) { 76 | if (engine->nextTick()) { 77 | engine->tick(); 78 | } else { 79 | engine->render(); 80 | engine->swap(); 81 | } 82 | } 83 | engine->stopEngine(); 84 | return 0; 85 | } 86 | 87 | #if EM_USE_ALLEGRO 88 | END_OF_MAIN(); 89 | #endif 90 | -------------------------------------------------------------------------------- /base/SoundUtil.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | SoundUtil.h - description 3 | ------------------- 4 | begin : Thu Jan 11 2001 5 | copyright : (C) 2001 by Henrik Enqvist, GPL 6 | email : henqvist@excite.com 7 | ***************************************************************************/ 8 | 9 | 10 | #ifndef SOUNDUTIL_H 11 | #define SOUNDUTIL_H 12 | 13 | #include 14 | #include 15 | #include 16 | 17 | #ifndef PRIVATE_H 18 | #error Must include Private.h before SoundUtil.h 19 | #endif 20 | 21 | #if EM_USE_SDL 22 | #include 23 | #include 24 | 25 | #define EmSample Mix_Chunk 26 | #define EmMusic Mix_Music 27 | 28 | #define EM_AUDIO_FREQ 22050 29 | #define EM_AUDIO_FORMAT AUDIO_S16 30 | #define EM_AUDIO_CHANNELS 2 31 | #endif // EM_USE_SDL 32 | 33 | #if EM_USE_ALLEGRO 34 | #include 35 | #define EmSample SAMPLE 36 | #define EmMusic MIDI 37 | #endif 38 | 39 | /** Singleton class for loading and playing samples */ 40 | class SoundUtil { 41 | protected: 42 | SoundUtil(); 43 | public: 44 | ~SoundUtil(); 45 | static SoundUtil* getInstance(); 46 | /** Initializes the sound system. Used by Engine constructor. 47 | ** You don't need this use the Config class to turn on/off sound. 48 | ** @see Config */ 49 | int initSound(); 50 | /** Shuts down sound system. Used by Engine::stopEngine. 51 | ** You don't need this use the Config class to turn on/off sound. 52 | ** @see Config */ 53 | void stopSound(); 54 | void applyConfigVolume(); 55 | // TODO 56 | void freeSounds(); 57 | /** Loads a wave file. Returns the identifier of the sound, used for playback. 58 | ** Returns -1 if it fails to load the wave file. */ 59 | int loadSample(const char * filename); 60 | /** Loads a midi file. Returns the identifier of the sound, used for playback. 61 | ** Returns -1 if it fails to load the midi file. */ 62 | int loadMusic(const char * filename); 63 | void playSample(int sound, bool loop); 64 | void playMusic(int sound, bool loop); 65 | void stopMusic(); 66 | void pauseMusic(); 67 | void resumeMusic(); 68 | const char * getSoundName(int sound); 69 | const char * getMusicName(int music); 70 | private: 71 | bool m_bInited; 72 | int m_iLoopingMusic; 73 | vector m_vEmSample; 74 | vector m_vEmMusic; 75 | map m_hEmSample; 76 | map m_hEmMusic; 77 | map m_hSoundName; 78 | map m_hMusicName; 79 | static SoundUtil* p_SoundUtil; 80 | }; 81 | 82 | #endif 83 | -------------------------------------------------------------------------------- /test/signal.cpp: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | Simple test. A cube should be visible in the middle of the screen. 3 | The arrow keys rotates the cube. 4 | ***************************************************************************/ 5 | 6 | #include 7 | 8 | #include "Private.h" 9 | #include "Engine.h" 10 | #include "Camera.h" 11 | #include "Cube.h" 12 | #include "Keyboard.h" 13 | #include "Behavior.h" 14 | #include "Shape3D.h" 15 | #include "StateMachine.h" 16 | 17 | /** A behavior class that implements a onSignal method */ 18 | class SignalTest : public Behavior { 19 | public: 20 | void StdOnSignal(); 21 | void StdOnCollision() {}; 22 | void StdOnTick() {}; 23 | }; 24 | 25 | void SignalTest::StdOnSignal() { 26 | OnSignal(1) { 27 | cerr << "Got signal 1" << endl; 28 | if (this->getParent() != NULL) { 29 | Shape3D* shape = this->getParent()->getShape3D(0); 30 | if (shape != NULL) shape->setColor(1,1,1,1); 31 | } 32 | } 33 | OnSignal(2) { 34 | cerr << "Got signal 2" << endl; 35 | if (this->getParent() != NULL) { 36 | Shape3D* shape = this->getParent()->getShape3D(0); 37 | if (shape != NULL) shape->setColor(1,0,1,1); 38 | } 39 | } 40 | } 41 | 42 | /** Main */ 43 | int main(int argc, char *argv[]) { 44 | cerr << "Simple emilia test." << endl; 45 | 46 | // Create the engine. 47 | Engine* engine = new Engine(argc, argv); 48 | engine->setLightning(0.5f, 0.1f); 49 | 50 | // Add a camera. Move a bit. 51 | Camera* camera = new Camera(); 52 | Group* groupCamera = new Group(); 53 | engine->add(groupCamera); 54 | groupCamera->setCamera(camera); 55 | groupCamera->setTranslation(0, 0, 3); 56 | engine->setEngineCamera(groupCamera); 57 | // Add a cube. 58 | Cube* cube = new Cube(1.0, 1.0, 1.0, 0.0, 1.0); 59 | Group* groupCube = new Group(); 60 | engine->add(groupCube); 61 | groupCube->addShape3D(cube); 62 | 63 | // Add a behavior to the cube 64 | SignalTest* beh = new SignalTest(); 65 | groupCube->setBehavior(beh); 66 | 67 | engine->resetTick(); 68 | while (!Keyboard::isKeyDown(SDLK_ESCAPE)) { 69 | if (Keyboard::isKeyDown(SDLK_1)) { 70 | // multicast a signal 71 | SendSignal(1, 0, engine, NULL); 72 | } 73 | if (Keyboard::isKeyDown(SDLK_2)) { 74 | // multicast a signal with delay 75 | SendSignal(2, 50, engine, NULL); 76 | } 77 | if (engine->nextTick()) { 78 | engine->tick(); 79 | } else { 80 | engine->render(); 81 | engine->swap(); 82 | } 83 | } 84 | delete(engine); 85 | return 0; 86 | } 87 | 88 | #if EM_USE_ALLEGRO 89 | END_OF_MAIN(); 90 | #endif 91 | 92 | -------------------------------------------------------------------------------- /extra/profile/pinball/etc/pinball/install.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | # -*- mode: Bash; tab-width: 2; indent-tabs-mode: nil; coding: utf-8 -*- 3 | # vim:shiftwidth=4:softtabstop=4:tabstop=4: 4 | # SPDX-License-Identifier: GPL-2.0+ 5 | set -e 6 | set -x 7 | 8 | project='pinball' 9 | [ "" != "$PINBALL_BRANCH" ] || PINBALL_BRANCH='next' 10 | sudo=$(which sudo || echo) 11 | 12 | ${sudo} apt --fix-broken install -y 13 | 14 | if [ "apt" = "$PINBALL_BRANCH" ] ; then 15 | ${sudo} apt-get install --yes pinball 16 | else 17 | ${sudo} apt-get install --yes base-files gnupg curl 18 | 19 | . /etc/os-release 20 | distro="${ID}_${VERSION_ID}" 21 | 22 | if [ "debian" = "${ID}" ] ; then 23 | [ "${VERSION_ID}" != "" ] || VERSION_ID="11" 24 | distro="${ID}_${VERSION_ID}" 25 | [ 12 -ge 0${VERSION_ID} ] || distro="${ID}_Testing" 26 | fi 27 | distro=$(echo "${distro}" | sed 's/.*/\u&/') 28 | if [ "ubuntu" = "$ID" ] ; then 29 | distro="x${distro}" 30 | fi 31 | url="http://download.opensuse.org/repositories" 32 | url="$url/home:/rzrfreefr" 33 | [ "${PINBALL_BRANCH}" = "" ] || url="$url:/${PINBALL_BRANCH}" 34 | url="${url}/${distro}" 35 | list="/etc/apt/sources.list.d/${project}.list" 36 | suffix="-snapshot" 37 | 38 | if [ -e "$list" ] ; then 39 | echo "warning: file '$list' exists please remove or update manualy" 40 | cat /etc/os-release ||: 41 | cat "$list" 42 | else 43 | echo "deb [allow-insecure=yes] $url /" | ${sudo} tee "$list" 44 | mkdir -p ${HOME}/.gnupg 45 | curl -s "${url}/Release.key" | gpg --with-fingerprint 46 | curl "${url}/Release.key" | ${sudo} apt-key add -v - 47 | fi 48 | 49 | ${sudo} apt-get clean 50 | ${sudo} apt-get update 51 | 52 | package="${project}" 53 | package_list="${package} \ 54 | ${project}-table-gnu \ 55 | ${project}-table-hurd \ 56 | " 57 | ${sudo} apt-get remove -y ${package_list} ||: 58 | 59 | for package in ${package_list} ; do 60 | 61 | ${sudo} apt-cache show ${package} 62 | ${sudo} apt-cache show ${package}${suffix} 63 | 64 | version=$(apt-cache show "${package}${suffix}" \ 65 | | grep 'Version:' | cut -d' ' -f2 | sort -n | head -n1 \ 66 | || echo 0) 67 | 68 | ${sudo} apt-get remove --yes ${package} ||: 69 | 70 | ${sudo} apt-get install --yes \ 71 | --allow-downgrades --allow-unauthenticated \ 72 | ${package}${suffix}=${version} \ 73 | ${package}=${version} \ 74 | ${package}-data=${version} \ 75 | ||: 76 | done 77 | fi 78 | ${sudo} apt --fix-broken install -y 79 | -------------------------------------------------------------------------------- /extra/debos/pinball.yaml: -------------------------------------------------------------------------------- 1 | {{- $architecture := or .architecture "i386" -}} 2 | {{- $cmdline := or .cmdline "root=LABEL=root rootwait ro fsck.mode=auto fsck.repair=yes console=ttyS1,115200" -}} 3 | {{- $machine := or .machine "generic" -}} 4 | {{- $mirror := or .mirror "https://deb.debian.org/debian" -}} 5 | {{- $project := or .project "pinball" -}} 6 | {{- $suite := or .suite "bullseye" -}} 7 | {{- $uboot_machine := or .uboot_machine "generic" -}} 8 | {{- $image := or .image (printf "%s-%s-%s.img" $project $architecture $machine) -}} 9 | 10 | architecture: {{$architecture}} 11 | 12 | actions: 13 | - action: debootstrap 14 | suite: {{$suite}} 15 | components: 16 | - main 17 | - non-free 18 | mirror: {{$mirror}} 19 | variant: minbase 20 | 21 | - action: run 22 | chroot: true 23 | command: | 24 | cat /etc/os-release 25 | cat< /README.md 34 | 35 | - action: run 36 | chroot: true 37 | command: apt-cache search linux-image 38 | 39 | - action: apt 40 | packages: [systemd-sysv, 41 | adduser, 42 | sudo, 43 | ] 44 | 45 | - action: recipe 46 | recipe: machine/{{$machine}}/actions.yaml 47 | variables: 48 | architecture: {{$architecture}} 49 | image: {{$image}} 50 | machine: {{$machine}} 51 | uboot_machine: {{$uboot_machine}} 52 | 53 | - action: run 54 | chroot: true 55 | command: echo {{$project}} > /etc/hostname 56 | 57 | - action: run 58 | description: Set up user 59 | chroot: true 60 | command: > 61 | /sbin/adduser --gecos user --disabled-password --shell /bin/bash user 62 | && /sbin/adduser user sudo 63 | && sh -c "echo 'user:user' | chpasswd" 64 | 65 | - action: overlay 66 | source: ../../extra/profile/pinball/etc/pinball/ 67 | destination: /etc/pinball/ 68 | 69 | - action: overlay 70 | source: ../../extra/profile/pincab/etc/pinball/ 71 | destination: /etc/pinball/ 72 | 73 | - action: run 74 | chroot: true 75 | script: ../../extra/profile/pinball/etc/pinball/setup.sh 76 | - action: filesystem-deploy 77 | description: Deploying filesystem onto image 78 | setup-kernel-cmdline: true 79 | append-kernel-cmdline: {{$cmdline}} 80 | 81 | - action: recipe 82 | recipe: machine/{{$machine}}/image.yaml 83 | variables: 84 | architecture: {{$architecture}} 85 | image: {{$image}} 86 | machine: {{$machine}} 87 | uboot_machine: {{$uboot_machine}} 88 | -------------------------------------------------------------------------------- /test/misc.cpp: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | Triangle point distance test. 3 | ***************************************************************************/ 4 | 5 | #include 6 | 7 | #include "Private.h" 8 | #include "Engine.h" 9 | #include "Camera.h" 10 | #include "Cube.h" 11 | #include "Cone.h" 12 | #include "Keyboard.h" 13 | #include "KeyBehavior.h" 14 | #include "KeyRotBehavior.h" 15 | #include "Shape3D.h" 16 | #include "Polygon.h" 17 | #include "CollisionBounds.h" 18 | #include "EMath.h" 19 | #include "CollisionVisitor.h" 20 | #include "Cube.h" 21 | 22 | /** A Triangle */ 23 | class TriClass : public Shape3D { 24 | public: 25 | TriClass(); 26 | ~TriClass() {}; 27 | }; 28 | 29 | TriClass::TriClass() { 30 | this->add(1, -1, 0, 1.0f, 0.0f, 1.0f, 1.0f, 0.0f, 0.0f); 31 | this->add(-1, -1, 0, 1.0f, 0.0f, 1.0f, 1.0f, 0.0f, 0.0f); 32 | this->add(0, 1, 0, 1.0f, 0.0f, 1.0f, 1.0f, 0.0f, 0.0f); 33 | this->add(1, 1, 0, 1.0f, 0.0f, 1.0f, 1.0f, 0.0f, 0.0f); 34 | 35 | Polygon3D * p = new Polygon3D(this, 3); 36 | p->add(0); 37 | p->add(1); 38 | p->add(2); 39 | p->add(3); 40 | this->add(p); 41 | 42 | this->countNormals(); 43 | } 44 | 45 | /** Main */ 46 | int main(int argc, char *argv[]) { 47 | cerr << "Simple emilia test." << endl; 48 | 49 | // Create the engine. 50 | Engine* engine = new Engine(argc, argv); 51 | engine->setLightning(0.5f, 0.1f); 52 | 53 | // Add a camera. Move a bit. 54 | Camera* camera = new Camera(); 55 | Group* groupCamera = new Group(); 56 | engine->add(groupCamera); 57 | groupCamera->setCamera(camera); 58 | groupCamera->setTranslation(0, 0, 2); 59 | engine->setEngineCamera(groupCamera); 60 | 61 | engine->addShape3D(new Cube(0.1f, 1.0f, 1.0f, 1.0f, 1.0f)); 62 | 63 | Group * gt = new Group(); 64 | engine->add(gt); 65 | gt->setBehavior(new KeyBehavior()); 66 | Group * gr = new Group(); 67 | gt->add(gr); 68 | gr->setBehavior(new KeyRotBehavior()); 69 | TriClass * tri = new TriClass(); 70 | gr->addShape3D(tri); 71 | 72 | Vertex3D vtx = {0.0f, 0.0f, 0.0f}; 73 | Vertex3D vtxDist; 74 | engine->resetTick(); 75 | engine->setSpeed(10); 76 | while (!Keyboard::isKeyDown(SDLK_ESCAPE)) { 77 | if (engine->nextTick()) { 78 | engine->tick(); 79 | float sqrdist = CollisionVisitor::getInstance()-> 80 | vtxPolySqrDist(vtx, tri->getPolygon(0), vtxDist); 81 | cerr << EMath::emSqrt(sqrdist) <<" : "<< 82 | vtxDist.x <<" "<< vtxDist.y <<" "<< vtxDist.z << endl; 83 | } else { 84 | engine->render(); 85 | engine->swap(); 86 | } 87 | } 88 | 89 | delete(engine); 90 | return 0; 91 | } 92 | 93 | #if EM_USE_ALLEGRO 94 | END_OF_MAIN(); 95 | #endif 96 | --------------------------------------------------------------------------------