├── VERSION ├── VERSION_CODE ├── .gitignore ├── indent.txt ├── AUTHORS ├── icon.png ├── readme.txt ├── data ├── fly.smp ├── bump.mod ├── calib.dat ├── death.smp ├── font.pcx ├── jump.mod ├── jump.smp ├── level.pcx ├── mask.pcx ├── menu.pcx ├── rabbit.pcx ├── scores.mod ├── splash.smp ├── spring.smp ├── menumask.pcx ├── numbers.pcx ├── objects.pcx ├── pack.bat ├── levelmap.txt ├── numbers.txt ├── rabbit.txt ├── objects.txt └── font.txt ├── jumpnbump.ico ├── levelmaking ├── pack.gif ├── level.pcx ├── making1.gif ├── making2.gif └── making3.gif ├── switchdata └── icon0.jpg ├── psp2data └── sce_sys │ ├── icon0.png │ └── livearea │ └── contents │ ├── bg.png │ ├── startup.png │ └── template.xml ├── screenshots └── jumpnbump_shot_1.png ├── generate_jumpbump_dat_c.sh ├── readme-win32.txt ├── LINKS ├── generate_version_h.sh ├── ios ├── cydia-deb-control ├── ios-info.plist.xml └── build-cydia-deb.sh ├── generate_jumpbump_dat.sh ├── filter.h ├── android ├── JNBActivity.java └── build-android.sh ├── gob.txt ├── README.md ├── sdl ├── jumpnbump32.xpm ├── jumpnbump64.xpm ├── input.c ├── interrpt.c ├── sound.c └── jumpnbump128.xpm ├── README ├── ChangeLog ├── modify ├── jnbunpack.c ├── jnbpack.c └── gobpack.c ├── source.txt ├── dj.h ├── filter.c ├── CMakeLists.txt ├── fireworks.c ├── globals.h ├── COPYING └── menu.c /VERSION: -------------------------------------------------------------------------------- 1 | 2.0 2 | -------------------------------------------------------------------------------- /VERSION_CODE: -------------------------------------------------------------------------------- 1 | 2 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /CMakeLists.txt.user 2 | -------------------------------------------------------------------------------- /indent.txt: -------------------------------------------------------------------------------- 1 | indent -kr -i8 -l1000 -lps -nhnl 2 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsn8887/jumpnbump/HEAD/AUTHORS -------------------------------------------------------------------------------- /icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsn8887/jumpnbump/HEAD/icon.png -------------------------------------------------------------------------------- /readme.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsn8887/jumpnbump/HEAD/readme.txt -------------------------------------------------------------------------------- /data/fly.smp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsn8887/jumpnbump/HEAD/data/fly.smp -------------------------------------------------------------------------------- /data/bump.mod: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsn8887/jumpnbump/HEAD/data/bump.mod -------------------------------------------------------------------------------- /data/calib.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsn8887/jumpnbump/HEAD/data/calib.dat -------------------------------------------------------------------------------- /data/death.smp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsn8887/jumpnbump/HEAD/data/death.smp -------------------------------------------------------------------------------- /data/font.pcx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsn8887/jumpnbump/HEAD/data/font.pcx -------------------------------------------------------------------------------- /data/jump.mod: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsn8887/jumpnbump/HEAD/data/jump.mod -------------------------------------------------------------------------------- /data/jump.smp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsn8887/jumpnbump/HEAD/data/jump.smp -------------------------------------------------------------------------------- /data/level.pcx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsn8887/jumpnbump/HEAD/data/level.pcx -------------------------------------------------------------------------------- /data/mask.pcx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsn8887/jumpnbump/HEAD/data/mask.pcx -------------------------------------------------------------------------------- /data/menu.pcx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsn8887/jumpnbump/HEAD/data/menu.pcx -------------------------------------------------------------------------------- /data/rabbit.pcx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsn8887/jumpnbump/HEAD/data/rabbit.pcx -------------------------------------------------------------------------------- /data/scores.mod: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsn8887/jumpnbump/HEAD/data/scores.mod -------------------------------------------------------------------------------- /data/splash.smp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsn8887/jumpnbump/HEAD/data/splash.smp -------------------------------------------------------------------------------- /data/spring.smp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsn8887/jumpnbump/HEAD/data/spring.smp -------------------------------------------------------------------------------- /jumpnbump.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsn8887/jumpnbump/HEAD/jumpnbump.ico -------------------------------------------------------------------------------- /data/menumask.pcx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsn8887/jumpnbump/HEAD/data/menumask.pcx -------------------------------------------------------------------------------- /data/numbers.pcx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsn8887/jumpnbump/HEAD/data/numbers.pcx -------------------------------------------------------------------------------- /data/objects.pcx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsn8887/jumpnbump/HEAD/data/objects.pcx -------------------------------------------------------------------------------- /levelmaking/pack.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsn8887/jumpnbump/HEAD/levelmaking/pack.gif -------------------------------------------------------------------------------- /switchdata/icon0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsn8887/jumpnbump/HEAD/switchdata/icon0.jpg -------------------------------------------------------------------------------- /levelmaking/level.pcx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsn8887/jumpnbump/HEAD/levelmaking/level.pcx -------------------------------------------------------------------------------- /levelmaking/making1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsn8887/jumpnbump/HEAD/levelmaking/making1.gif -------------------------------------------------------------------------------- /levelmaking/making2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsn8887/jumpnbump/HEAD/levelmaking/making2.gif -------------------------------------------------------------------------------- /levelmaking/making3.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsn8887/jumpnbump/HEAD/levelmaking/making3.gif -------------------------------------------------------------------------------- /psp2data/sce_sys/icon0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsn8887/jumpnbump/HEAD/psp2data/sce_sys/icon0.png -------------------------------------------------------------------------------- /screenshots/jumpnbump_shot_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsn8887/jumpnbump/HEAD/screenshots/jumpnbump_shot_1.png -------------------------------------------------------------------------------- /psp2data/sce_sys/livearea/contents/bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsn8887/jumpnbump/HEAD/psp2data/sce_sys/livearea/contents/bg.png -------------------------------------------------------------------------------- /psp2data/sce_sys/livearea/contents/startup.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsn8887/jumpnbump/HEAD/psp2data/sce_sys/livearea/contents/startup.png -------------------------------------------------------------------------------- /generate_jumpbump_dat_c.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | echo unsigned char default_jumpbump_dat[] = { > jumpbump_dat.c || exit $? 3 | hexdump -v -e '16/1 "0x%x," "\n"' jumpbump.dat | sed s/0x,//g >> jumpbump_dat.c || exit $? 4 | echo 0x0 \}\; >> jumpbump_dat.c || exit $? 5 | 6 | -------------------------------------------------------------------------------- /data/pack.bat: -------------------------------------------------------------------------------- 1 | cd %1 2 | %2 font 3 | %2 rabbit 4 | %2 numbers 5 | %2 objects 6 | %3 -o jumpbump.dat bump.mod calib.dat death.smp fly.smp font.gob jump.mod jump.smp levelmap.txt level.pcx mask.pcx menu.pcx menumask.pcx numbers.gob objects.gob rabbit.gob scores.mod splash.smp spring.smp 7 | -------------------------------------------------------------------------------- /readme-win32.txt: -------------------------------------------------------------------------------- 1 | This port is done by Florian Schulze (crow@icculus.org). 2 | Homepage: http://www.icculus.org/jumpnbump/ 3 | 4 | There is a new scaled up graphics mode. To use it add -scaleup to the command line. 5 | The sound is now much better than in the old SDL versions. 6 | 7 | Florian Schulze -------------------------------------------------------------------------------- /LINKS: -------------------------------------------------------------------------------- 1 | http://www.jumpbump.mine.nu/ 2 | http://www.icculus.org/jumpnbump/ 3 | http://freshmeat.net/projects/jumpnbump/ 4 | http://www.geocities.com/bkron2000 5 | http://bloodybunnies.8m.com/ 6 | http://gohanz.www7.50megs.com/jumpbump/ 7 | http://brainchilddesign.com/games/jumpnbump/index.html 8 | http://www.libsdl.org/ 9 | -------------------------------------------------------------------------------- /generate_version_h.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #CURRENT_SCRIPT="`readlink -f $0`" 4 | SRC_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" 5 | 6 | echo \#define JNB_VERSION \"`cat "${SRC_DIR}/VERSION"`\" > version.h 7 | echo \#define JNB_VERSION \"`cat "${SRC_DIR}/VERSION"`\" > ${SRC_DIR}/version.h 8 | 9 | -------------------------------------------------------------------------------- /ios/cydia-deb-control: -------------------------------------------------------------------------------- 1 | Package: org.jumpnbump 2 | Version: VERSION_PLACEHOLDER 3 | Priority: optional 4 | Architecture: iphoneos-arm 5 | Description: Jump'n'Bump is a multiplayer platform game with bunnies 6 | Maintainer: Felix Hädicke 7 | Homepage: https://github.com/felixhaedicke/jumpnbump 8 | Section: Games 9 | -------------------------------------------------------------------------------- /psp2data/sce_sys/livearea/contents/template.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | bg.png 6 | 7 | 8 | 9 | startup.png 10 | 11 | 12 | -------------------------------------------------------------------------------- /data/levelmap.txt: -------------------------------------------------------------------------------- 1 | 1110000000000000000000 2 | 1000000000001000011000 3 | 1000111100001100000000 4 | 1000000000011110000011 5 | 1100000000111000000001 6 | 1110001111110000000001 7 | 1000000000000011110001 8 | 1000000000000000000011 9 | 1110011100000000000111 10 | 1000000000003100000001 11 | 1000000000031110000001 12 | 1011110000311111111001 13 | 1000000000000000000001 14 | 1100000000000000000011 15 | 2222222214000001333111 16 | 1111111111111111111111 -------------------------------------------------------------------------------- /generate_jumpbump_dat.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #CURRENT_SCRIPT="`readlink -f $0`" 4 | #SRC_DIR="`dirname ${CURRENT_SCRIPT}`" 5 | SRC_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" 6 | 7 | gcc ${SRC_DIR}/modify/gobpack.c 8 | ./a.out ${SRC_DIR}/data/numbers 9 | ./a.out ${SRC_DIR}/data/objects 10 | ./a.out ${SRC_DIR}/data/rabbit 11 | ./a.out ${SRC_DIR}/data/font 12 | gcc -o b.out ${SRC_DIR}/modify/jnbpack.c 13 | ./b.out \ 14 | -o jumpbump.dat \ 15 | ${SRC_DIR}/data/bump.mod \ 16 | ${SRC_DIR}/data/calib.dat \ 17 | ${SRC_DIR}/data/death.smp \ 18 | ${SRC_DIR}/data/fly.smp \ 19 | ${SRC_DIR}/data/jump.mod \ 20 | ${SRC_DIR}/data/jump.smp \ 21 | ${SRC_DIR}/data/levelmap.txt \ 22 | ${SRC_DIR}/data/level.pcx \ 23 | ${SRC_DIR}/data/mask.pcx \ 24 | ${SRC_DIR}/data/menu.pcx \ 25 | ${SRC_DIR}/data/menumask.pcx \ 26 | ${SRC_DIR}/data/scores.mod \ 27 | ${SRC_DIR}/data/splash.smp \ 28 | ${SRC_DIR}/data/spring.smp \ 29 | numbers.gob \ 30 | objects.gob \ 31 | rabbit.gob \ 32 | font.gob 33 | 34 | -------------------------------------------------------------------------------- /data/numbers.txt: -------------------------------------------------------------------------------- 1 | num_images: 10 2 | 3 | image: 1 4 | x: 0 5 | y: 0 6 | width: 16 7 | height: 22 8 | hotspot_x: 0 9 | hotspot_y: 0 10 | 11 | image: 2 12 | x: 18 13 | y: 0 14 | width: 16 15 | height: 22 16 | hotspot_x: 0 17 | hotspot_y: 0 18 | 19 | image: 3 20 | x: 36 21 | y: 0 22 | width: 16 23 | height: 22 24 | hotspot_x: 0 25 | hotspot_y: 0 26 | 27 | image: 4 28 | x: 54 29 | y: 0 30 | width: 16 31 | height: 22 32 | hotspot_x: 0 33 | hotspot_y: 0 34 | 35 | image: 5 36 | x: 72 37 | y: 0 38 | width: 16 39 | height: 22 40 | hotspot_x: 0 41 | hotspot_y: 0 42 | 43 | image: 6 44 | x: 90 45 | y: 0 46 | width: 16 47 | height: 22 48 | hotspot_x: 0 49 | hotspot_y: 0 50 | 51 | image: 7 52 | x: 108 53 | y: 0 54 | width: 16 55 | height: 22 56 | hotspot_x: 0 57 | hotspot_y: 0 58 | 59 | image: 8 60 | x: 126 61 | y: 0 62 | width: 16 63 | height: 22 64 | hotspot_x: 0 65 | hotspot_y: 0 66 | 67 | image: 9 68 | x: 144 69 | y: 0 70 | width: 16 71 | height: 22 72 | hotspot_x: 0 73 | hotspot_y: 0 74 | 75 | image: 10 76 | x: 162 77 | y: 0 78 | width: 16 79 | height: 22 80 | hotspot_x: 0 81 | hotspot_y: 0 82 | 83 | -------------------------------------------------------------------------------- /filter.h: -------------------------------------------------------------------------------- 1 | /* 2 | * config.h 3 | * Copyright (C) 1998 Brainchild Design - http://brainchilddesign.com/ 4 | * 5 | * Copyright (C) 2001 Chuck Mason 6 | * 7 | * Copyright (C) 2002 Florian Schulze 8 | * 9 | * This file is part of Jump'n'Bump. 10 | * 11 | * Jump'n'Bump is free software; you can redistribute it and/or modify 12 | * it under the terms of the GNU General Public License as published by 13 | * the Free Software Foundation; either version 2 of the License, or 14 | * (at your option) any later version. 15 | * 16 | * Jump'n'Bump is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU General Public License for more details. 20 | * 21 | * You should have received a copy of the GNU General Public License 22 | * along with this program; if not, write to the Free Software 23 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 24 | */ 25 | 26 | #ifndef __FILTER_H__ 27 | #define __FILTER_H__ 28 | 29 | void do_scale2x(unsigned char *src, 30 | int src_width, 31 | int src_height, 32 | unsigned char *dst); 33 | 34 | #endif // __FILTER_H__ 35 | -------------------------------------------------------------------------------- /ios/ios-info.plist.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleDisplayName 8 | Jump'n'Bump 9 | CFBundleExecutable 10 | jumpnbump 11 | CFBundleIdentifier 12 | org.jumpnbump 13 | CFBundleName 14 | Jumpnbump 15 | CFBundlePackageType 16 | APPL 17 | CFBundleSignature 18 | ???? 19 | CFBundleInfoDictionaryVersion 20 | 6.0 21 | CFBundleVersion 22 | 2.0 23 | LSRequiresIPhoneOS 24 | 25 | CFBundleIconFile 26 | 27 | Icon.png 28 | Icon@2x.png 29 | Icon-72.png 30 | 31 | UIStatusBarHidden 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /android/JNBActivity.java: -------------------------------------------------------------------------------- 1 | package org.jumpnbump; 2 | 3 | import org.libsdl.app.SDLActivity; 4 | 5 | import android.annotation.SuppressLint; 6 | import android.os.Bundle; 7 | import android.view.View; 8 | import android.view.ViewConfiguration; 9 | 10 | public class JNBActivity extends SDLActivity { 11 | 12 | @Override 13 | protected void onResume() { 14 | super.onResume(); 15 | enableImmersiveModeIfNeeded(); 16 | } 17 | 18 | @Override 19 | public void onWindowFocusChanged(boolean hasFocus) { 20 | if (hasFocus) { 21 | enableImmersiveModeIfNeeded(); 22 | } 23 | super.onWindowFocusChanged(hasFocus); 24 | } 25 | 26 | @Override 27 | protected void onCreate(Bundle savedInstanceState) { 28 | enableImmersiveModeIfNeeded(); 29 | super.onCreate(savedInstanceState); 30 | } 31 | 32 | @SuppressLint("NewApi") 33 | private void enableImmersiveModeIfNeeded() { 34 | if ((android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.KITKAT) && (!ViewConfiguration.get(this).hasPermanentMenuKey())) { 35 | getWindow().getDecorView().setSystemUiVisibility( 36 | View.SYSTEM_UI_FLAG_LAYOUT_STABLE 37 | | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION 38 | | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN 39 | | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION 40 | | View.SYSTEM_UI_FLAG_FULLSCREEN 41 | | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY); 42 | } 43 | } 44 | 45 | } 46 | 47 | -------------------------------------------------------------------------------- /gob.txt: -------------------------------------------------------------------------------- 1 | THE FORMAT OF GOBFILES 2 | 3 | Do YOU want to make your own GOB-files? 4 | Then you have to know the GOB format! 5 | Here you can find a brief desciption of it. 6 | (this is all about how the file is saved) 7 | Note: Everything is saved in Intel byteorder, 8 | ie the least significant byte first. 9 | 10 | 11 | THE HEADER 12 | 13 | Offset Size Description 14 | 0 2 Number of images in the file 15 | 16 | 17 | For I=1 to Number of images 18 | 19 | Offset Size Description 20 | 2+I*4 4 Offset in file to image data 21 | 22 | End repeat 23 | 24 | 25 | The above offsets are offsets from the beginning of 26 | the file. Each image has it's own image data. 27 | The image data is like this: 28 | 29 | 30 | THE IMAGE DATA 31 | 32 | Offset Size Description 33 | 0 2 Image width in pixels (W) 34 | 2 2 Image height in pixels (H) 35 | 4 2 Hotspot x 36 | 6 2 Hotspot y 37 | 8 W*H Bitmap data 38 | 39 | 40 | The offsets above are offsets in the image data (for each image). 41 | 42 | The Hotspot x/y of a specific image works like this: 43 | Whenever a sprite is drawn at (x, y) with that image, 44 | the image is drawn at (x - hotspot x, y - hotspot y), 45 | where hotspot x/y are the hotspots for that image. 46 | 47 | The bitmap data is just a block of colordata for each pixel. 48 | It scans the image horisontally left/down. This means that 49 | the first byte represents the upper left pixel, the second 50 | represents the pixel to the right of that and so on. 51 | If the width is 10 pixels then the 10th byte of bitmap data 52 | will represent the pixel (0, 1). 53 | -------------------------------------------------------------------------------- /ios/build-cydia-deb.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | CURRENT_SCRIPT="`readlink -f $0`" 4 | SRC_DIR="`dirname ${CURRENT_SCRIPT}`"/../ 5 | 6 | convert ${SRC_DIR}/data/menu.pcx -gravity center -crop 256x256+0+0 iOS-icon-rect.png || exit $? 7 | convert -size 256x256 xc:none -fill white -draw "roundRectangle 0,0, 256, 256 25,25" iOS-icon-rect.png -compose SrcIn -composite iOS-icon-256.png || exit $? 8 | 9 | mkdir -p cydia-package/Applications/Jumpnbump.app || exit $? 10 | cp jumpnbump cydia-package/Applications/Jumpnbump.app || exit $? 11 | mkdir -p cydia-package/DEBIAN || exit $? 12 | sed "s/VERSION_PLACEHOLDER/`cat ${SRC_DIR}/VERSION`/g" ${SRC_DIR}/ios/cydia-deb-control > cydia-package/DEBIAN/control || exit $? 13 | 14 | plutil -i ${SRC_DIR}/ios/ios-info.plist.xml -o cydia-package/Applications/Jumpnbump.app/Info.plist || exit $? 15 | convert ${SRC_DIR}/data/menu.pcx -resize 480x320 -rotate 270 cydia-package/Applications/Jumpnbump.app/Default.png || exit $? 16 | convert ${SRC_DIR}/data/menu.pcx -resize 960x640 -rotate 270 cydia-package/Applications/Jumpnbump.app/Default@2x.png || exit $? 17 | convert ${SRC_DIR}/data/menu.pcx -resize 1136x640 -rotate 270 cydia-package/Applications/Jumpnbump.app/Default-568h@2x.png || exit $? 18 | convert ${SRC_DIR}/data/menu.pcx -resize 1004x768 -rotate 270 cydia-package/Applications/Jumpnbump.app/Default-Portrait.png || exit $? 19 | convert ${SRC_DIR}/data/menu.pcx -resize 2008x1536 -rotate 270 cydia-package/Applications/Jumpnbump.app/Default-Portrait.png || exit $? 20 | convert ${SRC_DIR}/data/menu.pcx -resize 1024x768 cydia-package/Applications/Jumpnbump.app/Default-Landscape.png || exit $? 21 | convert ${SRC_DIR}/data/menu.pcx -resize 2048x1496 cydia-package/Applications/Jumpnbump.app/Default-Landscape@2x.png || exit $? 22 | convert iOS-icon-256.png -resize 57x57 cydia-package/Applications/Jumpnbump.app/Icon.png || exit $? 23 | convert iOS-icon-256.png -resize 72x72 cydia-package/Applications/Jumpnbump.app/Icon72.png || exit $? 24 | convert iOS-icon-256.png -resize 114x114 cydia-package/Applications/Jumpnbump.app/Icon@2x.png || exit $? 25 | dpkg-deb -b cydia-package jumpnbump.deb || exit $? 26 | 27 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Overview 2 | ===== 3 | This is my Switch and Vita port of the classic multiplayer-only MS-DOS game Jump'n'Bump by Brainchild Design, based on the SDL2 port by @felixhaedicke. 4 | 5 | Jump'n'Bump is a simple but addictive multiplayer game. The goal is to stomp as many other rabbits as possible to win the game. 6 | 7 | ![](screenshots/jumpnbump_shot_1.png) 8 | 9 | Thanks 10 | ====== 11 | Thanks to my supporters on Patreon: Andyways, Count Duckula, Jesse Harlin, Thomas Luten, Matthew Machnee, Mored4u, Ibrahim Fazel Poor, RadicalR. 12 | 13 | Thanks to the many developers of the game, such as Mattias Brynervall, Andreas Brynervall, Anders Nilsson, and many more. 14 | 15 | Thanks to Felix Haedicke for porting the game to SDL2 and Cmake. 16 | 17 | Installation Instructions 18 | ===== 19 | Switch: 20 | - Extract the contents of jumpnbump_switch.zip into the `switch` folder on your SD card, so that you have a folder `switch/jumpnbump` with `jumpnbump.nro` inside. 21 | 22 | Vita: 23 | - install the .vpk file using Vitashell 24 | 25 | Switch/Vita-exclusive features 26 | ===== 27 | - Split Joycon support (Switch only): To toggle between split and combined Joycons, press L on joycon 1. 28 | - Physical keyboard support via Bluetooth (Vita) and USB (Switch) 29 | 30 | Controls 31 | ===== 32 | Left analog stick / Dpad = move the character, up to four controllers are supported 33 | B / Y / A / X = Jump 34 | Plus/Minus/Select/Start = ESC (restart game/advance through statistic screens) 35 | R (on controller 1) = toggle aspect ratio between original (default), 4:3, and 16:9 36 | L (on controller 1) = toggle split Joycon mode on/off (Switch only) 37 | 38 | Physical keyboard controls via Bluetooth (Vita) and USB (Switch): 39 | Cursor keys = white rabbit move and jump 40 | a d w = yellow rabbit move and jump 41 | i j l = gray rabbit move and jump 42 | Keypad 4 / 8 / 6 = brown rabbit move and jump 43 | 44 | Build Instructions 45 | ===== 46 | Switch: 47 | ```` 48 | cmake -DBUILD_NX=ON -DCMAKE_RELEASE_TYPE=Release 49 | make jumpnbump_switch.zip -j12 50 | ```` 51 | 52 | Vita: 53 | ```` 54 | cmake -DBUILD_PSP2=ON -DCMAKE_RELEASE_TYPE=Release 55 | make jumpnbump.vpk -j12 56 | ```` 57 | 58 | Changelog 59 | ===== 60 | v1.02 (Switch only) 61 | 62 | - Re-compile with 12.0.0 support 63 | 64 | v1.01 (Switch only) 65 | 66 | - Re-compile with 9.0.0 support 67 | 68 | v1.00 69 | 70 | - First release on Switch and Vita -------------------------------------------------------------------------------- /sdl/jumpnbump32.xpm: -------------------------------------------------------------------------------- 1 | /* XPM */ 2 | static char * jumpnbump_xpm[] = { 3 | "32 32 65 1", 4 | " c None", 5 | ". c #261814", 6 | "+ c #B3B3B2", 7 | "@ c #EC7818", 8 | "# c #747373", 9 | "$ c #B83A18", 10 | "% c #6D6D6B", 11 | "& c #C8C1BB", 12 | "* c #6B3203", 13 | "= c #DB8434", 14 | "- c #E28A32", 15 | "; c #DCCEC6", 16 | "> c #CA7C30", 17 | ", c #A05618", 18 | "' c #2A262A", 19 | ") c #999998", 20 | "! c #F59239", 21 | "~ c #9B4E10", 22 | "{ c #EFE8E4", 23 | "] c #FDB055", 24 | "^ c #AB530B", 25 | "/ c #3A363A", 26 | "( c #8F8E8D", 27 | "_ c #CE6915", 28 | ": c #6A4E3A", 29 | "< c #BEB8B2", 30 | "[ c #EF9A47", 31 | "} c #F4F1F0", 32 | "| c #C0691C", 33 | "1 c #661834", 34 | "2 c #C8A68C", 35 | "3 c #434143", 36 | "4 c #894209", 37 | "5 c #C2610F", 38 | "6 c #F79E3F", 39 | "7 c #848482", 40 | "8 c #504C4C", 41 | "9 c #5E2E06", 42 | "0 c #823E06", 43 | "a c #F6C29E", 44 | "b c #EAB68A", 45 | "c c #967A60", 46 | "d c #D6A67A", 47 | "e c #8B6241", 48 | "f c #B66016", 49 | "g c #FDA542", 50 | "h c #FCFCFD", 51 | "i c #846A54", 52 | "j c #E6A86C", 53 | "k c #ABA7A5", 54 | "l c #BA590C", 55 | "m c #F8DCC2", 56 | "n c #AE9276", 57 | "o c #864C1E", 58 | "p c #585757", 59 | "q c #E0DDDB", 60 | "r c #733403", 61 | "s c #5E3A1E", 62 | "t c #7B7B7B", 63 | "u c #FEAA48", 64 | "v c #F68627", 65 | "w c #F97B13", 66 | "x c #746D6A", 67 | "y c #DAB69E", 68 | "z c #B45A0F", 69 | " ", 70 | " ", 71 | " )) ", 72 | " x (7# ", 73 | " )k p8 (## ", 74 | " k)& ((p3 (%) ", 75 | " }k<< kt(p8 7t( ", 76 | " qq+h b+(+p%)7() ", 77 | " )}{&6y;& 8#t7( ", 78 | " vuuu[q}}bq{;]ppt7(|: ", 79 | " >ugu]kqh{}{&[~3t((tsvwv ", 80 | " ,=]]{hhhhh{-f8p7)px#@vvvvv ", 81 | " ,]]}hhhhhhjo'8t(tp7@vvvvv ", 82 | " ~>j{&{{}hhms.8%t7%cf|w!! ", 83 | " ~__w@@nt})}hhm4./p%%#$*05! ", 84 | " ^@www@=ac ", 90 | " ***9*****~_^-]]]u6=zfi% ", 91 | " ***r**9**l_^^[!=|^^^^x%% ", 92 | " 9********l5z^||^^^^^,##x% ", 93 | " ******r5_l^^^^^^^ex%%x%% ", 94 | " ***r*055fz^^,^e%x####t# ", 95 | " ****0_5l^^,exx%%#%%% ", 96 | " **4555ex%%%%% ", 97 | " *~l %x%## ", 98 | " ", 99 | " ", 100 | " "}; 101 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | Jump n Bump 2 | 3 | This is a game for the whole family. You are cute fluffy little bunnies 4 | and hop on the other bunnies' heads. 5 | 6 | At the beginning you are in the menu, where you have to jump 7 | over the tree trunk if you want to play and walk right. 8 | Then you'll enter the arena. The aim is to jump on the 9 | other bunnies' heads... 10 | 11 | a,w,d to steer Dott 12 | arrows to steer Jiffy 13 | j,i,l to steer Fizz 14 | 4,8,6 to steer Mijji (on the numeric pad) 15 | 16 | Thanks to sabrewulf (chuck mason) in irc.linux.com #keen 17 | who did port this wonderful game! find him, longislandman 18 | and me (tarzeau) on irc.linux.com 19 | Thanks also to longisland for working on network code 20 | and timecop for the pack/unpacker 21 | Thanks to florian for adding scale mode, fixing the sound 22 | bug and having alot of patience and maintaining everything. 23 | Thanks to ben for making patches to run it on mac os x. 24 | Thanks to ivo for doing debian packages. 25 | 26 | f10 change between windowed/fullscreen mode 27 | (see the XF86Config-4, copy n paste the modeline 400x256 28 | then add the mode "400x256" to whatever bpp you have by default, restart x) 29 | example: add following line in Section "Monitor" of your 30 | /etc/X11/XF86Config (or XF86Config-4) 31 | Modeline "400x256" 22.00 400 416 480 504 256 259 262 269 doublescan 32 | then in Section "Screen" if your DefaultDepth is 24 do be sure you have 33 | something like: 34 | Modes "1024x768" "640x480" "512x384" "400x256" "320x240" 35 | esc/f12 exit 36 | 37 | For compilation you will need: 38 | do following on a debian gnu/linux system (www.debian.org) 39 | apt-get install libsdl-dev libsdl-mixer-dev 40 | sdl libraries are needed, you might find it at www.libsdl.org 41 | 42 | You can find more levels at http://www.jumpbump.mine.nu/cgi-bin/jb.sh 43 | which you can start with: jumpnbump -dat levelname.dat 44 | there's a screensaver mode as well: 45 | jumpnbump -fireworks -fullscreen 46 | 47 | Network play works like this, oh well here's an example 48 | Player 1: jumpnbump -port 7777 -net 0 ip_or_hostname_of_player2 port_of_player2 49 | Player 2: jumpnbump -port 7777 -net 1 ip_or_hostname_of_player1 port_of_player1 50 | just take port 7777 for all ports and hope it's open and you aren't 51 | firewalled (it's all udp!) 52 | You can add -net 3 and -net 4 for 3rd and 4th player, and be sure. 53 | All the players use the same -dat level.dat 54 | (the scoreboards is different on each player and strange things like 55 | that, but longislandman is working on it (isn't it? longislandman? you alive?)) 56 | 57 | You can find the original dos game (which runs in dos/win9x (dosextender!)) 58 | at http://www.brainchilddesign.com/games/jumpnbump/index.html 59 | 60 | If you like the game or have any ideas don't hesitate to contact me 61 | gurkan@linuks.mine.nu 62 | 63 | -------------------------------------------------------------------------------- /ChangeLog: -------------------------------------------------------------------------------- 1 | 16 Jun 2004 - 1.50 2 | - AI Bunnies 3 | - Contributed level selectors for KDE and X 4 | 5 | 21 Mar 2003 - 1.41 6 | - new scaling filter which works with 8bit graphics. Removed the old scaler 7 | completely, now fading and everything else works in scaled up mode. 8 | - another attempt to fix sound on big endian systems. 9 | 10 | Sep 2002 - 1.40 11 | - manpage update 12 | - joystick support added 13 | - freebsd ports (thanks rigel from #demoscene) 14 | - a while back network code using kaillera was send to me by Gil Megidish, 15 | it's not enabled, because it doesn't seem to work good enough. 16 | 17 | 17 Aug 2002 - 1.39 18 | - added -noflies option 19 | - added client/server networking. Thanks to Ryan C. Gordon who did the base 20 | work for it. 21 | 22 | 11 Aug 2002 - 1.35 23 | - gobpack added 24 | - documentation updated 25 | - little fixes here and there 26 | 27 | 2 Aug 2002 - 1.34 28 | - fixed too dark font 29 | - attempt to fix sound and scaleup on big endian systems 30 | 31 | 5 Jul 2002 - 1.33 32 | - added -musicnosound option 33 | 34 | 15 Jun 2002 - 1.32 35 | - fix for off by one in -mirror 36 | add icon for application (macosx,windows,x) 37 | 38 | 10 Jun 2002 - 1.31 39 | - rename jbmenu.tcl to jnbmenu.tcl, make it +x, add 40 | options for -mirror and -scaleup 41 | update manpage and -h with -scaleup 42 | update makefiles accordingly 43 | rename pack/unpack to jnbpack/jnbunpack 44 | set gametitle 45 | 46 | 9 Jun 2002 - 1.3 47 | - Added -mirror commandline option to play the level mirrored 48 | - Deleting temporary music file 49 | 50 | - 1.2 51 | - MacOS X fixes 52 | - some endian fixes 53 | 54 | 24 Feb 2002 - 1.1 55 | - fixed timing problems 56 | - fixed crash when temporary music can't be written 57 | 58 | 22 Feb 2002 - 1.0 59 | - working sound 60 | - new scaling graphics mode 61 | - cleaned up code 62 | 63 | =========================================================================== 64 | This is the changelog of the linux version from which this port is derived. 65 | 66 | 25 Feb 2001 - 0.69 67 | initial linux port, worked fine with freebsd too (chuck mason) 68 | 69 | 26 Feb 2001 - 0.69 70 | made sound be played (chuck mason) 71 | 72 | 03 Mar 2001 - 0.70 73 | fixing fps (longislandman) 74 | changing player input: 4 player at one keyboard (tarzeau) 75 | pack/unpack which packs/unpacks the leveldata (timecop) 76 | 77 | ?? Mar 2001 - 0.70 78 | network code has been written (longislandman, jonatkins.org) 79 | it werks but we won't release it until it's good for the masses, 80 | for test and fun play come join #keen on irc.linux.com 81 | (be sure to have one udp port open if you have a firewall, 82 | and also have sdl-mixer, sdl and sdl-net) 83 | 84 | 16 Mar 2001 - 0.70 85 | did a new screenshot http://jumpbump.mine.nu/port/jumpbumprocks.jpg 86 | wrote a little faq http://jumpbump.mine.nu/port/jumpbumpfaq.txt 87 | put online level-selector-menu http://jumpbump.mine.nu/port/jbmenu.tcl 88 | (received from philippe brochard, thank you!) 89 | 90 | 20 Mar 2001 - 0.72 91 | repackaged tarballs with network code jnb-net.tar.gz, 92 | menusystem and unpack/pack 93 | -------------------------------------------------------------------------------- /modify/jnbunpack.c: -------------------------------------------------------------------------------- 1 | /* 2 | * unpack.c 3 | * Copyright (C) 1998 Brainchild Design - http://brainchilddesign.com/ 4 | * 5 | * Copyright (C) 2001 "timecop" 6 | * 7 | * Copyright (C) 2002 Florian Schulze 8 | * 9 | * This file is part of Jump'n'Bump. 10 | * 11 | * Jump'n'Bump is free software; you can redistribute it and/or modify 12 | * it under the terms of the GNU General Public License as published by 13 | * the Free Software Foundation; either version 2 of the License, or 14 | * (at your option) any later version. 15 | * 16 | * Jump'n'Bump is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU General Public License for more details. 20 | * 21 | * You should have received a copy of the GNU General Public License 22 | * along with this program; if not, write to the Free Software 23 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 24 | */ 25 | 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #ifndef _MSC_VER 33 | #include 34 | #else 35 | #include 36 | #endif 37 | 38 | typedef struct { 39 | char filename[12]; 40 | unsigned int offset; 41 | unsigned int size; 42 | } DirEntry; 43 | 44 | #ifndef O_BINARY 45 | #define O_BINARY 0 46 | #endif 47 | 48 | int main(int argc, char **argv) 49 | { 50 | int fd; 51 | DirEntry *datafile; 52 | int num_entries, i; 53 | 54 | if (argc < 2) { 55 | printf("dumbass, specify filename to unpack\n"); 56 | exit(1); 57 | } 58 | 59 | fd = open(argv[1], O_RDONLY | O_BINARY); 60 | if (fd == -1) { 61 | perror("open datafile"); 62 | exit(1); 63 | } 64 | /* get number of entries */ 65 | read(fd, &num_entries, 4); 66 | 67 | printf("%d entries in datafile\n", num_entries); 68 | 69 | datafile = calloc(num_entries, sizeof(DirEntry)); 70 | read(fd, datafile, num_entries * sizeof(DirEntry)); 71 | printf("Directory Listing:\n"); 72 | for (i = 0; i < num_entries; i++) { 73 | char filename[14]; 74 | memset(filename, 0, sizeof(filename)); 75 | strncpy(filename, datafile[i].filename, 12); 76 | printf("%02d:\t%s (%u bytes)\n", i, filename, 77 | datafile[i].size); 78 | } 79 | 80 | for (i = 0; i < num_entries; i++) { 81 | int outfd; 82 | char filename[14]; 83 | char *buf; 84 | memset(filename, 0, sizeof(filename)); 85 | strncpy(filename, datafile[i].filename, 12); 86 | printf("Extracting %s ", filename); 87 | fflush(stdout); 88 | 89 | if (unlink(filename) == -1 && errno != ENOENT) { 90 | perror("cannot unlink file"); 91 | exit(1); 92 | } 93 | outfd = open(filename, O_RDWR | O_CREAT | O_EXCL | O_BINARY, 0644); 94 | if (!outfd) { 95 | perror("cant open file"); 96 | exit(1); 97 | } 98 | lseek(fd, datafile[i].offset, SEEK_SET); 99 | buf = calloc(1, datafile[i].size + 16); 100 | read(fd, buf, datafile[i].size); 101 | write(outfd, buf, datafile[i].size); 102 | close(outfd); 103 | free(buf); 104 | printf("OK\n"); 105 | } 106 | close(fd); 107 | return 0; 108 | } 109 | -------------------------------------------------------------------------------- /source.txt: -------------------------------------------------------------------------------- 1 | JUMP 'N BUMP 2 | 3 | Source Code Release 4 | by Brainchild Design in 99 5 | 6 | 7 | Ok, enough already! Too many people have been 8 | asking about the source code for Jump 'n Bump, 9 | but I've always said that it's messy and ugly 10 | and bad, and besides, nobody could really learn 11 | anything from it, certainly not how to design 12 | code. 13 | 14 | Then I remembered how excited I was when I got 15 | hold of the source code to Wolfenstein 3D by 16 | ID. Not that I really learned that much from 17 | it, it was far too complex for me at that time. 18 | That is also the reason that I don't care 19 | about source code. It takes far too long time 20 | to understand what happens, and I personally 21 | don't think it's worth it. 22 | 23 | Again, I thought about it for a while. And I 24 | can't say that there is that much source code 25 | for complete games out there. Mostly it's just 26 | "how to make this neat effect". Nothing wrong 27 | with that, it's just that there's so much more 28 | to making a game than that! 29 | 30 | So I finally decided to release the code. Do 31 | whatever you like with it. I've gotten e-mails 32 | saying things like "if I got the source, I could 33 | add multiplayer support over the internet". 34 | Yeah, right! Adding that would probably be 35 | harder than to totally rewrite the game. The 36 | code is poorly designed, making changes to is 37 | hard, if not impossible. Be warned! 38 | 39 | If I still haven't convinced you to stay away, 40 | then I would be glad to see what you manage 41 | to do with it. Some suggestions I've gotten for 42 | the game includes computer rabbits, network 43 | support, better menu with level-loading support, 44 | and so on. Oh, and 400x256 is NOT a good 45 | resolution, I can tell you that much. 46 | 47 | You'll need DJGPP to compile the code. You can 48 | find it on http://www.delorie.com. I recommend 49 | that you also get hold of RHIDE, a great IDE. 50 | If you need to recompile the ASM code, you will 51 | need NASM, which you can find on 52 | http://www.web-sites.co.uk/nasm/ 53 | 54 | Ok, here's a short explanation on how to get 55 | it to compile (I won't explain how to install 56 | DJGPP and RHIDE, there's plenty of info on that 57 | on the net): 58 | 59 | Move 'libdj.a' to DJGPP's LIB-directory and 60 | 'dj.h' to DJGPP's INCLUDE-directory. 61 | 62 | Start up RHIDE, and try opening the project 63 | 'jumpbump.gpr'. If that works then you'll be 64 | all set and ready to compile. If not, try 65 | setting all the directories in the project 66 | right, and so on. 67 | 68 | If you can't open the project, delete 69 | 'jumpbump.gpr' and 'jumpbump.gdt'. Start up 70 | RHIDE and create a new project. Add all *.o 71 | files and 'gfx.obj'. (The reason I add the 72 | object files instead of the source files is 73 | that my RHIDE always recompiled everything, 74 | not just what was changed.) Go into Local 75 | Options for 'gfx.obj' and change Name of the 76 | output file to 'gfx.obj'. In the menu, go for 77 | Options->Libraries. Write 'dj' on the first 78 | row, and put an X to the left of it. Now you 79 | should be able to compile. 80 | 81 | Oh, and please don't write to me and ask about 82 | the code. It was almost a year since I wrote it, 83 | and I really don't remember anything about it. 84 | 85 | Of course, I don't take any responsibility 86 | whatsoever to what might happen to you, your 87 | computer or your social life if you choose to 88 | use this. 89 | 90 | 'Nuff said! 91 | 92 | Mattias Brynervall, Brainchild Design 93 | http://www.brainchilddesign.com -------------------------------------------------------------------------------- /dj.h: -------------------------------------------------------------------------------- 1 | /* 2 | * dj.h 3 | * Copyright (C) 1998 Brainchild Design - http://brainchilddesign.com/ 4 | * 5 | * Copyright (C) 2002 Florian Schulze - crow@icculus.org 6 | * 7 | * This file is part of Jump'n'Bump. 8 | * 9 | * Jump'n'Bump is free software; you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation; either version 2 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * Jump'n'Bump is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with this program; if not, write to the Free Software 21 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 22 | */ 23 | 24 | #include 25 | #include 26 | 27 | #ifdef DOS 28 | #include 29 | #include 30 | #include 31 | #include 32 | #endif 33 | 34 | #define DJ_SD_TYPE_NOSOUND 0 35 | #define DJ_SD_TYPE_SBLASTER 1 36 | 37 | #define DJ_SFX_TYPE_SSS 0 38 | #define DJ_SFX_TYPE_WAV 1 39 | #define DJ_SFX_TYPE_SMP 2 40 | 41 | 42 | typedef struct dj_hardware_info { 43 | char sd_type; 44 | short sd_version; 45 | short port; 46 | char irq; 47 | char dma; 48 | } dj_hardware_info; 49 | 50 | typedef struct dj_mixing_info { 51 | char sfx_volume, num_sfx_channels; 52 | char mod_volume, num_mod_channels; 53 | char stereo_mix, auto_mix; 54 | unsigned short mixing_freq; 55 | unsigned short dma_time, dmabuf_len; 56 | char cur_dmabuf; 57 | unsigned long dmabuf_address[2]; 58 | char *mixed_buf; 59 | } dj_mixing_info; 60 | 61 | typedef struct sfx_data { 62 | char priority; 63 | unsigned short default_freq; 64 | char default_volume; 65 | unsigned long length; 66 | char loop; 67 | unsigned long loop_start, loop_length; 68 | unsigned char *buf; 69 | } sfx_data; 70 | 71 | typedef struct dj_mod_info { 72 | char num_channels; 73 | char speed; 74 | short bpm; 75 | char order_pos; 76 | char pat_pos; 77 | char name[20]; 78 | struct { 79 | char name[22]; 80 | unsigned short length; 81 | char finetune; 82 | char volume; 83 | unsigned short loop_start; 84 | unsigned short loop_length; 85 | char *buf; 86 | } samples[31]; 87 | char song_length; 88 | char num_pat; 89 | char pat_order[128]; 90 | char *pat[128]; 91 | } dj_mod_info; 92 | 93 | 94 | extern char dj_init(void); 95 | extern void dj_deinit(void); 96 | extern char dj_set_sd(char sd_type, short port, char irq, char dma); 97 | extern void dj_get_sd_string(char *strbuf); 98 | extern void dj_reverse_stereo(char flag); 99 | extern char dj_get_hardware_info(dj_hardware_info *ptr); 100 | extern char dj_get_mixing_info(dj_mixing_info *ptr); 101 | extern char dj_get_mod_info(char mod_num, dj_mod_info *ptr); 102 | extern void dj_set_fake_vu_speed(unsigned char speed); 103 | extern unsigned char dj_get_fake_vu(char channel); 104 | extern char dj_reset_sd(void); 105 | 106 | extern char dj_mix_needed(void); 107 | extern void dj_mix(void); 108 | 109 | extern char dj_set_num_sfx_channels(char num_channels); 110 | extern void dj_set_sfx_volume(char volume); 111 | extern char dj_get_sfx_volume(void); 112 | extern void dj_play_sfx(unsigned char sfx_num, unsigned short freq, char volume, signed char channel); 113 | extern char dj_get_sfx_settings(unsigned char sfx_num, sfx_data *data); 114 | extern char dj_set_sfx_settings(unsigned char sfx_num, sfx_data *data); 115 | extern void dj_set_sfx_channel_volume(char channel_num, char volume); 116 | extern void dj_stop_sfx_channel(char channel_num); 117 | extern char dj_load_sfx(unsigned char *file_handle, int file_length, unsigned char sfx_num); 118 | extern void dj_free_sfx(unsigned char sfx_num); 119 | 120 | extern char dj_ready_mod(char mod_num); 121 | extern char dj_start_mod(void); 122 | extern void dj_stop_mod(void); 123 | extern void dj_set_mod_volume(char volume); 124 | extern char dj_get_mod_volume(void); 125 | extern void dj_free_mod(char mod_num); 126 | 127 | -------------------------------------------------------------------------------- /android/build-android.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | SRC_SUBDIRS=". sdl" 3 | TARGET_SDK_VERSION=19 4 | 5 | ANDROID_SDK_DIR=$1 6 | ANDROID_NDK_DIR=$2 7 | SDL_SRC_DIR=$3 8 | SDL_MIXER_SRC_DIR=$4 9 | SDL_NET_SRC_DIR=$5 10 | BUILD_CONFIGURATION=$6 11 | 12 | if [ $# -lt 6 ] 13 | then 14 | echo "Usage: ./build-android.sh " >&2 15 | exit 1 16 | fi 17 | 18 | if [ "${BUILD_CONFIGURATION}" != "debug" ] && [ "${BUILD_CONFIGURATION}" != "release" ] 19 | then 20 | echo "Invalid build configuration \"${BUILD_CONFIGURATION}\"!" >&2 21 | exit 1 22 | fi 23 | 24 | CURRENT_SCRIPT="`readlink -f $0`" 25 | SRC_DIR="`dirname ${CURRENT_SCRIPT}`"/../ 26 | 27 | SDL_SRC_DIR="`readlink -f ${SDL_SRC_DIR}`" 28 | SDL_MIXER_SRC_DIR="`readlink -f ${SDL_MIXER_SRC_DIR}`" 29 | SDL_NET_SRC_DIR="`readlink -f ${SDL_NET_SRC_DIR}`" 30 | 31 | "${SRC_DIR}/generate_version_h.sh" || exit $? 32 | "${SRC_DIR}/generate_jumpbump_dat.sh" || exit $? 33 | "${SRC_DIR}/generate_jumpbump_dat_c.sh" || exit $? 34 | 35 | SRC_LIST="${PWD}/jumpbump_dat.c " 36 | for src_subdir in ${SRC_SUBDIRS} 37 | do 38 | for src_file in ${SRC_DIR}/${src_subdir}/*.c 39 | do 40 | src_file=`realpath ${src_file}` 41 | SRC_LIST="${SRC_LIST} ${src_file}" 42 | done 43 | done 44 | 45 | if [ -e "android-project" ] 46 | then 47 | echo "\"android-project\" exists already!" >&2 48 | exit 1 49 | fi 50 | 51 | cp -r "${SDL_SRC_DIR}/android-project" . || exit $? 52 | 53 | "${ANDROID_SDK_DIR}/tools/android" update project --name jumpnbump --target android-${TARGET_SDK_VERSION} --path android-project || exit $? 54 | 55 | mkdir -p android-project/src/org/jumpnbump || exit $? 56 | 57 | cp "${SRC_DIR}/android"/*.java android-project/src/org/jumpnbump || exit $? 58 | 59 | xmlstarlet ed -L -N android=http://schemas.android.com/apk/res/android -u //manifest/@android:versionCode -v `cat "${SRC_DIR}/VERSION_CODE"` android-project/AndroidManifest.xml || exit $? 60 | xmlstarlet ed -L -N android=http://schemas.android.com/apk/res/android -u //manifest/@android:versionName -v `cat "${SRC_DIR}/VERSION"` android-project/AndroidManifest.xml || exit $? 61 | xmlstarlet ed -L -N android=http://schemas.android.com/apk/res/android -u //manifest/@package -v org.jumpnbump android-project/AndroidManifest.xml || exit $? 62 | xmlstarlet ed -L -N android=http://schemas.android.com/apk/res/android -u //uses-sdk/@android:targetSdkVersion -v ${TARGET_SDK_VERSION} android-project/AndroidManifest.xml || exit $? 63 | xmlstarlet ed -L -N android=http://schemas.android.com/apk/res/android -u //activity/@android:name -v JNBActivity android-project/AndroidManifest.xml || exit $? 64 | xmlstarlet ed -L -N android=http://schemas.android.com/apk/res/android -i //activity -t attr -n android:screenOrientation -v sensorLandscape android-project/AndroidManifest.xml || exit $? 65 | xmlstarlet ed -L -u //string[\@name=\'app_name\'] -v "Jump\\'n\\'Bump" android-project/res/values/strings.xml || exit $? 66 | 67 | for i in `find android-project/res -name ic_launcher.png` 68 | do 69 | convert "${SRC_DIR}/icon.png" -resize `identify "$i" | awk '{print $3}'` "$i" || exit $? 70 | done 71 | 72 | ln -s "${SDL_SRC_DIR}" "android-project/jni/SDL" || exit $? 73 | echo "APP_PLATFORM := android-10" >> "android-project/jni/Application.mk" || exit $? 74 | sed -i "s|YourSourceHere.c|${SRC_LIST}|g" "android-project/jni/src/Android.mk" || exit $? 75 | sed -i "s|LOCAL_C_INCLUDES :=|LOCAL_C_INCLUDES := ${PWD} ${SRC_DIR} ../SDL_mixer ../SDL_net|g" "android-project/jni/src/Android.mk" || exit $? 76 | sed -i "s|LOCAL_SHARED_LIBRARIES :=|LOCAL_SHARED_LIBRARIES := SDL2_mixer SDL2_net|g" "android-project/jni/src/Android.mk" || exit $? 77 | 78 | ln -s "${SDL_MIXER_SRC_DIR}" "android-project/jni/SDL_mixer" || exit $? 79 | sed -i "s/SUPPORT_MOD_MIKMOD := true/SUPPORT_MOD_MIKMOD := false/g" "android-project/jni/SDL_mixer/Android.mk" || exit $? 80 | sed -i "s/SUPPORT_MP3_SMPEG := true/SUPPORT_MP3_SMPEG := false/g" "android-project/jni/SDL_mixer/Android.mk" || exit $? 81 | sed -i "s/SUPPORT_OGG := true/SUPPORT_OGG := false/g" "android-project/jni/SDL_mixer/Android.mk" || exit $? 82 | 83 | ln -s "${SDL_NET_SRC_DIR}" "android-project/jni/SDL_net" || exit $? 84 | 85 | sed -i "s|//System.loadLibrary(\"SDL2_mixer\")|System.loadLibrary(\"SDL2_mixer\")|g;" "android-project/src/org/libsdl/app/SDLActivity.java" || exit $? 86 | sed -i "s|//System.loadLibrary(\"SDL2_mixer\")|System.loadLibrary(\"SDL2_net\")|g;" "android-project/src/org/libsdl/app/SDLActivity.java" || exit $? 87 | 88 | cd android-project || exit $? 89 | NDK_BUILD_ARGS="-j4" 90 | if [ "${BUILD_CONFIGURATION}" != "debug" ] 91 | then 92 | NDK_BUILD_ARGS="${NDK_BUILD_ARGS} NDK_DEBUG=1" 93 | fi 94 | "${ANDROID_NDK_DIR}/ndk-build" ${NDK_BUILD_ARGS} || exit $? 95 | ANDROID_HOME="${ANDROID_SDK_DIR}" ant ${BUILD_CONFIGURATION} || exit $? 96 | 97 | -------------------------------------------------------------------------------- /modify/jnbpack.c: -------------------------------------------------------------------------------- 1 | /* 2 | * pack.c 3 | * Copyright (C) 1998 Brainchild Design - http://brainchilddesign.com/ 4 | * 5 | * Copyright (C) 2001 "timecop" 6 | * 7 | * Copyright (C) 2002 Florian Schulze 8 | * 9 | * This file is part of Jump'n'Bump. 10 | * 11 | * Jump'n'Bump is free software; you can redistribute it and/or modify 12 | * it under the terms of the GNU General Public License as published by 13 | * the Free Software Foundation; either version 2 of the License, or 14 | * (at your option) any later version. 15 | * 16 | * Jump'n'Bump is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU General Public License for more details. 20 | * 21 | * You should have received a copy of the GNU General Public License 22 | * along with this program; if not, write to the Free Software 23 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 24 | */ 25 | 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #ifdef LINUX 35 | #include 36 | #endif 37 | #ifndef _MSC_VER 38 | #include 39 | #else 40 | #include 41 | #endif 42 | 43 | typedef struct { 44 | char filename[12]; 45 | unsigned int offset; 46 | unsigned int size; 47 | } DirEntry; 48 | 49 | #ifndef O_BINARY 50 | #define O_BINARY 0 51 | #endif 52 | 53 | int main(int argc, char **argv) 54 | { 55 | int fd; 56 | DirEntry *datafile; 57 | int num_entries, i; 58 | int c; 59 | char *outfile = NULL; 60 | int offset = 0; 61 | 62 | #ifdef LINUX 63 | while ((c = getopt(argc, argv, "o:")) != EOF) { 64 | switch (c) { 65 | case 'o': 66 | if (optarg) { 67 | outfile = strdup(optarg); 68 | } 69 | break; 70 | } 71 | } 72 | argc -= optind; 73 | argv += optind; 74 | #else 75 | c = 1; 76 | while (c 12) { 123 | fprintf(stderr, "filename for file %s is longer than 12 chars\n", argv[i]); 124 | exit(1); 125 | } 126 | strncpy(datafile[i].filename, entry_basename, 12); 127 | datafile[i].size = dummy.st_size; 128 | /* num_entries * (12 + 8) */ 129 | datafile[i].offset = offset; 130 | offset += datafile[i].size; 131 | free(entry_path); 132 | } 133 | 134 | /* here, we checked that all files are ok, and ready to roll the packfile */ 135 | fd = open(outfile, O_RDWR | O_CREAT | O_BINARY, 0644); 136 | if (fd == -1) { 137 | perror("opening packfile"); 138 | exit(1); 139 | } 140 | printf("Opened %s\n", outfile); 141 | 142 | /* write number of entries in this data file */ 143 | { 144 | char temp; 145 | 146 | temp = (num_entries >> 0) & 0xff; 147 | write(fd, &temp, 1); 148 | temp = (num_entries >> 8) & 0xff; 149 | write(fd, &temp, 1); 150 | temp = (num_entries >> 16) & 0xff; 151 | write(fd, &temp, 1); 152 | temp = (num_entries >> 24) & 0xff; 153 | write(fd, &temp, 1); 154 | } 155 | 156 | /* write the directory structure */ 157 | for (i = 0; i < num_entries; i++) { 158 | char temp; 159 | 160 | write(fd, &datafile[i].filename, 12); 161 | temp = (datafile[i].offset >> 0) & 0xff; 162 | write(fd, &temp, 1); 163 | temp = (datafile[i].offset >> 8) & 0xff; 164 | write(fd, &temp, 1); 165 | temp = (datafile[i].offset >> 16) & 0xff; 166 | write(fd, &temp, 1); 167 | temp = (datafile[i].offset >> 24) & 0xff; 168 | write(fd, &temp, 1); 169 | temp = (datafile[i].size >> 0) & 0xff; 170 | write(fd, &temp, 1); 171 | temp = (datafile[i].size >> 8) & 0xff; 172 | write(fd, &temp, 1); 173 | temp = (datafile[i].size >> 16) & 0xff; 174 | write(fd, &temp, 1); 175 | temp = (datafile[i].size >> 24) & 0xff; 176 | write(fd, &temp, 1); 177 | } 178 | 179 | /* write in the actual files */ 180 | for (i = 0; i < num_entries; i++) { 181 | int infd; 182 | char *buf; 183 | 184 | printf("adding %s ", argv[i]); 185 | 186 | infd = open(argv[i], O_RDONLY | O_BINARY); 187 | if (infd == -1) { 188 | perror("opening file"); 189 | exit(1); 190 | } 191 | buf = malloc(datafile[i].size + 16); 192 | read(infd, buf, datafile[i].size); 193 | close(infd); 194 | write(fd, buf, datafile[i].size); 195 | free(buf); 196 | printf(" OK\n"); 197 | } 198 | close(fd); 199 | return 0; 200 | } 201 | -------------------------------------------------------------------------------- /sdl/jumpnbump64.xpm: -------------------------------------------------------------------------------- 1 | /* XPM */ 2 | static char * jumpnbump_xpm[] = { 3 | "64 64 65 1", 4 | " c None", 5 | ". c #171010", 6 | "+ c #B2B2B2", 7 | "@ c #E61E1A", 8 | "# c #6E6C6B", 9 | "$ c #C20606", 10 | "% c #D0C6C4", 11 | "& c #FA7A12", 12 | "* c #411A05", 13 | "= c #D06D19", 14 | "- c #DA8636", 15 | "; c #5B5B5B", 16 | "> c #979696", 17 | ", c #F18A2D", 18 | "' c #D9D6D4", 19 | ") c #7D0A5E", 20 | "! c #BD752F", 21 | "~ c #E8DED9", 22 | "{ c #BABABA", 23 | "] c #8B8A88", 24 | "^ c #F28E39", 25 | "/ c #724E32", 26 | "( c #5A2A02", 27 | "_ c #CA6410", 28 | ": c #E7E3DF", 29 | "< c #FEB256", 30 | "[ c #AB5309", 31 | "} c #D69256", 32 | "| c #EEEAEA", 33 | "1 c #563216", 34 | "2 c #828282", 35 | "3 c #C26210", 36 | "4 c #6A3202", 37 | "5 c #875F3D", 38 | "6 c #D5B5A0", 39 | "7 c #832907", 40 | "8 c #D9711E", 41 | "9 c #EF9E49", 42 | "0 c #F2F2F2", 43 | "a c #302C2F", 44 | "b c #7A7A7A", 45 | "c c #C6AA92", 46 | "d c #434043", 47 | "e c #FECA96", 48 | "f c #BA5A0A", 49 | "g c #A64911", 50 | "h c #FB8321", 51 | "i c #E5A673", 52 | "j c #AD621E", 53 | "k c #505150", 54 | "l c #7E6552", 55 | "m c #A9A6A3", 56 | "n c #F5B683", 57 | "o c #843F05", 58 | "p c #FAA23A", 59 | "q c #9E5A26", 60 | "r c #FAD6BA", 61 | "s c #92765A", 62 | "t c #974C0A", 63 | "u c #FCFCFD", 64 | "v c #F07616", 65 | "w c #FEA847", 66 | "x c #727272", 67 | "y c #F5993F", 68 | "z c #222026", 69 | " ", 70 | " ", 71 | " ", 72 | " ", 73 | " ", 74 | " >>> ", 75 | " >>2b ", 76 | " #x ]2b#x ", 77 | " k;k 2]2x# ", 78 | " 2+m ;dd ]>b#b ", 79 | " ]mm>> ;ka >>#;> ", 80 | " %>++0 ]] kkkd 22xx ", 81 | " :+>m|> mx] ;k;a 2xx2 ", 82 | " 0:bb': m2#> k;;d ]2b2> ", 83 | " |u+m+u {m2b+ ;;#k 222>> ", 84 | " %0''m0 n6++m> ;;#b> b]>>> ", 85 | " m000%~mpyi6%%%+ ;k#2]]x]>> ", 86 | " >:uu:%cww6%':'% d#bxb]]>] ", 87 | " www!'u000|>>]k.4-h ", 90 | " j-wwww>2b]2dj&h&&, ", 91 | " q-w>#z;>]dv,,hhhhhhh ", 92 | " t9<<]dd]c;8hhh,h,h^hh ", 93 | " o-<>;ax>#8&,,hhhh^h, ", 94 | " 4!ww>#dx>x8h,,&hh,^h ", 95 | " t-ww6:u0u0uuuuuuuuu09j*..d;#b22>bkb>b8^hh,^,hhy ", 96 | " t8,c'0b+{u0{:uuuuuuej..zdk;#xx22xb]jooot=&yy ", 97 | " f8&v=v&-cmz%:u'k:uuuuuur=*.zdd;;###xsxf@41((4_^^ ", 98 | " t[vvv&&&&&v-#.|0u'k0uuuuu0r=*.aaakk;;##x5g$4otf=^yp ", 99 | " [&&&&&&&&&f5~|0'buuuuuu0%=4*..zdkkk;kdk)7t8hpypppp ", 100 | " 3&&&&&&&&&v&&nr+uuuuuu|}=o***.zaaadd/q3vpwwpppwwy ", 101 | " t=&&&&&&&&&&v^ru0uu|:'}_ft*.)..z1q8h^wwwpwwppppww ", 102 | " j8&&&&&&&&&&^n||0:'683g*)))(j8,^py 6 | * 7 | * Copyright (C) 2002 Florian Schulze 8 | * 9 | * This file is part of Jump'n'Bump. 10 | * 11 | * Jump'n'Bump is free software; you can redistribute it and/or modify 12 | * it under the terms of the GNU General Public License as published by 13 | * the Free Software Foundation; either version 2 of the License, or 14 | * (at your option) any later version. 15 | * 16 | * Jump'n'Bump is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU General Public License for more details. 20 | * 21 | * You should have received a copy of the GNU General Public License 22 | * along with this program; if not, write to the Free Software 23 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 24 | */ 25 | 26 | #include "globals.h" 27 | 28 | #include 29 | 30 | #include 31 | 32 | int num_joys=0; 33 | SDL_Joystick* joys[4]; 34 | SDL_Joystick* accelerometer = NULL; 35 | 36 | /* assumes joysticks have at least one button, could check numbuttons first? */ 37 | #ifdef __IPHONEOS__ 38 | # define ACCELEROMETER_JOY_SUPPORTED 39 | # define ACCELEROMETER_JOY_LEFT() (accelerometer && SDL_JoystickGetAxis(accelerometer, 1)>350) 40 | # define ACCELEROMETER_JOY_RIGHT() (accelerometer && SDL_JoystickGetAxis(accelerometer, 1)<-350) 41 | #elif defined(__ANDROID__) 42 | # define ACCELEROMETER_JOY_SUPPORTED 43 | # define ACCELEROMETER_JOY_LEFT() (accelerometer && SDL_JoystickGetAxis(accelerometer, 0)<-1500) 44 | # define ACCELEROMETER_JOY_RIGHT() (accelerometer && SDL_JoystickGetAxis(accelerometer, 0)>1500) 45 | #else 46 | # define ACCELEROMETER_JOY_LEFT() (0) 47 | # define ACCELEROMETER_JOY_RIGHT() (0) 48 | #endif 49 | 50 | #ifdef __SWITCH__ 51 | extern int single_joycon_mode; 52 | extern int keep_aspect; 53 | static int can_change_single_joycon_mode = 1; 54 | static int can_change_keep_aspect = 1; 55 | #define JOY_CHANGESINGLEJOYCON(num) (num_joys>num && SDL_JoystickGetButton(joys[num], 6)) 56 | #define JOY_CHANGEKEEPASPECT(num) (num_joys>num && SDL_JoystickGetButton(joys[num], 7)) 57 | #define JOY_JUMP(num) (num_joys>num && (SDL_JoystickGetButton(joys[num], 0) || SDL_JoystickGetButton(joys[num], 1) || SDL_JoystickGetButton(joys[num], 2) || SDL_JoystickGetButton(joys[num], 3))) 58 | #define JOY_LEFT(num) (num_joys>num && (SDL_JoystickGetButton(joys[num], 16) || SDL_JoystickGetButton(joys[num], 12))) 59 | #define JOY_RIGHT(num) (num_joys>num && (SDL_JoystickGetButton(joys[num], 18) || SDL_JoystickGetButton(joys[num], 14))) 60 | #elif defined(__PSP2__) 61 | extern int keep_aspect; 62 | static int can_change_keep_aspect = 1; 63 | #define JOY_CHANGEKEEPASPECT(num) (num_joys>num && (SDL_JoystickGetButton(joys[num], 4) || SDL_JoystickGetButton(joys[num], 5))) 64 | #define JOY_JUMP(num) (num_joys>num && (SDL_JoystickGetButton(joys[num], 0) || SDL_JoystickGetButton(joys[num], 1) || SDL_JoystickGetButton(joys[num], 2) || SDL_JoystickGetButton(joys[num], 3))) 65 | #define JOY_LEFT(num) (num_joys>num && ((SDL_JoystickGetAxis(joys[num], 0)<-3200) || SDL_JoystickGetButton(joys[num], 7))) 66 | #define JOY_RIGHT(num) (num_joys>num && ((SDL_JoystickGetAxis(joys[num], 0)>3200) || SDL_JoystickGetButton(joys[num], 9))) 67 | #else 68 | /* I find using the vertical axis to be annoying -- dnb */ 69 | #define JOY_JUMP(num) (num_joys>num && (SDL_JoystickGetButton(joys[num], 0) || SDL_JoystickGetButton(joys[num], 20))) 70 | #define JOY_LEFT(num) (num_joys>num && SDL_JoystickGetAxis(joys[num], 0)<-3200) 71 | #define JOY_RIGHT(num) (num_joys>num && SDL_JoystickGetAxis(joys[num], 0)>3200) 72 | #endif 73 | 74 | void update_player_actions(void) 75 | { 76 | int tmp; 77 | 78 | if (client_player_num < 0) { 79 | tmp = (key_pressed(KEY_PL1_LEFT) == 1) || ACCELEROMETER_JOY_LEFT() || JOY_LEFT(3); 80 | if (tmp != player[0].action_left) 81 | tellServerPlayerMoved(0, MOVEMENT_LEFT, tmp); 82 | tmp = (key_pressed(KEY_PL1_RIGHT) == 1) || ACCELEROMETER_JOY_RIGHT() || JOY_RIGHT(3); 83 | if (tmp != player[0].action_right) 84 | tellServerPlayerMoved(0, MOVEMENT_RIGHT, tmp); 85 | tmp = (key_pressed(KEY_PL1_JUMP) == 1) || JOY_JUMP(3); 86 | if (tmp != player[0].action_up) 87 | tellServerPlayerMoved(0, MOVEMENT_UP, tmp); 88 | 89 | tmp = (key_pressed(KEY_PL2_LEFT) == 1) || JOY_LEFT(2); 90 | if (tmp != player[1].action_left) 91 | tellServerPlayerMoved(1, MOVEMENT_LEFT, tmp); 92 | tmp = (key_pressed(KEY_PL2_RIGHT) == 1) || JOY_RIGHT(2); 93 | if (tmp != player[1].action_right) 94 | tellServerPlayerMoved(1, MOVEMENT_RIGHT, tmp); 95 | tmp = (key_pressed(KEY_PL2_JUMP) == 1) || JOY_JUMP(2); 96 | if (tmp != player[1].action_up) 97 | tellServerPlayerMoved(1, MOVEMENT_UP, tmp); 98 | 99 | tmp = (key_pressed(KEY_PL3_LEFT) == 1) || JOY_LEFT(1); 100 | if (tmp != player[2].action_left) 101 | tellServerPlayerMoved(2, MOVEMENT_LEFT, tmp); 102 | tmp = (key_pressed(KEY_PL3_RIGHT) == 1) || JOY_RIGHT(1); 103 | if (tmp != player[2].action_right) 104 | tellServerPlayerMoved(2, MOVEMENT_RIGHT, tmp); 105 | tmp = (key_pressed(KEY_PL3_JUMP) == 1) || JOY_JUMP(1); 106 | if (tmp != player[2].action_up) 107 | tellServerPlayerMoved(2, MOVEMENT_UP, tmp); 108 | 109 | tmp = (key_pressed(KEY_PL4_LEFT) == 1) || JOY_LEFT(0); 110 | if (tmp != player[3].action_left) 111 | tellServerPlayerMoved(3, MOVEMENT_LEFT, tmp); 112 | tmp = (key_pressed(KEY_PL4_RIGHT) == 1) || JOY_RIGHT(0); 113 | if (tmp != player[3].action_right) 114 | tellServerPlayerMoved(3, MOVEMENT_RIGHT, tmp); 115 | tmp = (key_pressed(KEY_PL4_JUMP) == 1) || JOY_JUMP(0); 116 | if (tmp != player[3].action_up) 117 | tellServerPlayerMoved(3, MOVEMENT_UP, tmp); 118 | } else { 119 | tmp = (key_pressed(KEY_PL1_LEFT) == 1) || JOY_LEFT(0); 120 | if (tmp != player[client_player_num].action_left) 121 | tellServerPlayerMoved(client_player_num, MOVEMENT_LEFT, tmp); 122 | tmp = (key_pressed(KEY_PL1_RIGHT) == 1) || JOY_RIGHT(0); 123 | if (tmp != player[client_player_num].action_right) 124 | tellServerPlayerMoved(client_player_num, MOVEMENT_RIGHT, tmp); 125 | tmp = (key_pressed(KEY_PL1_JUMP) == 1) || JOY_JUMP(0); 126 | if (tmp != player[client_player_num].action_up) 127 | tellServerPlayerMoved(client_player_num, MOVEMENT_UP, tmp); 128 | } 129 | #if defined(__SWITCH__) || defined(__PSP2__) 130 | if (can_change_keep_aspect && JOY_CHANGEKEEPASPECT(0)) { 131 | can_change_keep_aspect = 0; 132 | keep_aspect++; 133 | keep_aspect %= 3; 134 | } 135 | if (!can_change_keep_aspect && !JOY_CHANGEKEEPASPECT(0)) { 136 | can_change_keep_aspect = 1; 137 | } 138 | #endif 139 | 140 | #ifdef __SWITCH__ 141 | if (can_change_single_joycon_mode && JOY_CHANGESINGLEJOYCON(0)) { 142 | can_change_single_joycon_mode = 0; 143 | single_joycon_mode = !single_joycon_mode; 144 | } 145 | if (!can_change_single_joycon_mode && !JOY_CHANGESINGLEJOYCON(0)) { 146 | can_change_single_joycon_mode = 1; 147 | } 148 | #endif 149 | } 150 | 151 | void init_inputs(void) 152 | { 153 | int i, j = 0; 154 | 155 | num_joys = SDL_NumJoysticks(); 156 | for(i = 0; i < num_joys; ++i) { 157 | int is_accelerometer = 0; 158 | #ifdef ACCELEROMETER_JOY_SUPPORTED 159 | if (!accelerometer) { 160 | const char* name = SDL_JoystickNameForIndex(i); 161 | if (name && strcasestr(name, "accelerometer")) { 162 | is_accelerometer = 1; 163 | } 164 | } 165 | #endif 166 | 167 | if ((is_accelerometer) || (j < 4)) 168 | { 169 | SDL_Joystick* joystick = SDL_JoystickOpen(i); 170 | if (joystick) { 171 | if (is_accelerometer) { 172 | accelerometer = joystick; 173 | } else { 174 | joys[j] = joystick; 175 | ++j; 176 | } 177 | } else { 178 | fprintf(stderr, "Could not open joystick %d", i); 179 | } 180 | } 181 | } 182 | 183 | main_info.mouse_enabled = 0; 184 | main_info.joy_enabled = 0; 185 | } 186 | -------------------------------------------------------------------------------- /filter.c: -------------------------------------------------------------------------------- 1 | /* 2 | * filter.c 3 | * Copyright (C) 2003 Florian Schulze 4 | * 5 | * This file is part of Jump'n'Bump. 6 | * 7 | * Jump'n'Bump is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 2 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * Jump'n'Bump is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; if not, write to the Free Software 19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | 22 | /* 23 | The following scaling filter is called advancedmame2x. 24 | The implementation found here was possible because of the great ideas of 25 | Lucas Pope. 26 | */ 27 | 28 | typedef unsigned char byte; 29 | static int scale2x_inited = 0; 30 | static byte lookup_map[4*16]; 31 | 32 | void init_scale2x(void) 33 | { 34 | int i; 35 | 36 | if (scale2x_inited) 37 | return; 38 | 39 | //------------------------------------------------------------------------- 40 | // scale2x takes the following source: 41 | // A B C 42 | // D E F 43 | // G H I 44 | // 45 | // and doubles the size of E to produce: 46 | // E0 E1 47 | // E2 E3 48 | // 49 | // E0 = D == B && B != F && D != H ? D : E; 50 | // E1 = B == F && B != D && F != H ? F : E; 51 | // E2 = D == H && D != B && H != F ? D : E; 52 | // E3 = H == F && D != H && B != F ? F : E; 53 | // 54 | // to make this comparison regimen faster, we encode source color 55 | // equivalency into a single byte with the getCode() macro 56 | // 57 | // #define getCode(b,f,h,d) ( (b == f)<<0 | (f == h)<<1 | (h == d)<<2 | (d == b)<<3 ) 58 | 59 | // encode the scale2x conditionals into a lookup code 60 | for (i=0; i<16; i++) { 61 | // E0 = D == B && B != F && D != H ? D : E; // 10-0 => 1000 or 1010 => 8 or A 62 | lookup_map[0*16+i] = (i == 0x8 || i == 0xA) ? 0 : 1; 63 | // E1 = B == F && B != D && F != H ? F : E; // 0-01 => 0101 or 0001 => 5 or 1 64 | lookup_map[1*16+i] = (i == 0x5 || i == 0x1) ? 2 : 1; 65 | // E2 = D == H && D != B && H != F ? D : E; // 010- => 0101 or 0100 => 5 or 4 66 | lookup_map[2*16+i] = (i == 0x4 || i == 0x5) ? 0 : 1; 67 | // E3 = H == F && D != H && B != F ? F : E; // -010 => 1010 or 0010 => A or 2 68 | lookup_map[3*16+i] = (i == 0xA || i == 0x2) ? 2 : 1; 69 | } 70 | } 71 | 72 | void do_scale2x(unsigned char *src, 73 | int src_width, 74 | int src_height, 75 | unsigned char *dst) 76 | { 77 | int x; 78 | int y; 79 | int dst_width = src_width * 2; 80 | //int dst_height = src_height * 2; 81 | int code; 82 | byte rowColors[3]; 83 | byte *e0; 84 | byte *e1; 85 | byte *e2; 86 | byte *e3; 87 | 88 | if (!scale2x_inited) 89 | init_scale2x(); 90 | 91 | // special top case - b is always unknown 92 | { 93 | byte *d; 94 | byte *e; 95 | byte *f; 96 | byte *h; 97 | 98 | e0 = &dst[0]; 99 | e1 = &dst[1]; 100 | e2 = &dst[dst_width]; 101 | e3 = &dst[dst_width + 1]; 102 | e = &src[0]; 103 | f = &src[1]; 104 | h = &src[src_width]; 105 | 106 | // special left case - d is unknown 107 | rowColors[0] = *e; 108 | rowColors[1] = *e; 109 | rowColors[2] = *f; 110 | code = ( (*f == *h)<<1 ); 111 | *e0 = rowColors[lookup_map[0*16+code]]; 112 | *e1 = rowColors[lookup_map[1*16+code]]; 113 | *e2 = rowColors[lookup_map[2*16+code]]; 114 | *e3 = rowColors[lookup_map[3*16+code]]; 115 | e++; f++; h++; 116 | d = &src[src_width]; // (src_width - 1) + 1 117 | e0+=2; e1+=2; e2+=2; e3+=2; 118 | 119 | // normal case 120 | for (x=1; x<(src_width-1); x++) { 121 | rowColors[0] = *d; 122 | rowColors[1] = *e; 123 | rowColors[2] = *f; 124 | code = ( (*f == *h)<<1 | (*h == *d)<<2 ); 125 | *e0 = rowColors[lookup_map[0*16+code]]; 126 | *e1 = rowColors[lookup_map[1*16+code]]; 127 | *e2 = rowColors[lookup_map[2*16+code]]; 128 | *e3 = rowColors[lookup_map[3*16+code]]; 129 | d++; e++; f++; h++; 130 | e0+=2; e1+=2; e2+=2; e3+=2; 131 | } 132 | 133 | // special right case - f is unknown 134 | rowColors[0] = *d; 135 | rowColors[1] = *e; 136 | rowColors[2] = *e; 137 | code = ( (*h == *d)<<2 ); 138 | *e0 = rowColors[lookup_map[0*16+code]]; 139 | *e1 = rowColors[lookup_map[1*16+code]]; 140 | *e2 = rowColors[lookup_map[2*16+code]]; 141 | *e3 = rowColors[lookup_map[3*16+code]]; 142 | } 143 | 144 | // top and bottom always known 145 | for (y=1; y<(src_height-1); y++) { 146 | byte *b; 147 | byte *d; 148 | byte *e; 149 | byte *f; 150 | byte *h; 151 | 152 | e0 = &dst[y*dst_width*2]; 153 | e1 = &dst[y*dst_width*2 + 1]; 154 | e2 = &dst[y*dst_width*2 + dst_width]; 155 | e3 = &dst[y*dst_width*2 + dst_width + 1]; 156 | b = &src[y * src_width - src_width]; 157 | e = &src[y * src_width]; 158 | f = &src[y * src_width + 1]; 159 | h = &src[y * src_width + src_width]; 160 | 161 | // special left case - d is unknown 162 | rowColors[0] = *e; 163 | rowColors[1] = *e; 164 | rowColors[2] = *f; 165 | code = ( (*b == *f)<<0 | (*f == *h)<<1 ); 166 | *e0 = rowColors[lookup_map[0*16+code]]; 167 | *e1 = rowColors[lookup_map[1*16+code]]; 168 | *e2 = rowColors[lookup_map[2*16+code]]; 169 | *e3 = rowColors[lookup_map[3*16+code]]; 170 | b++; e++; f++; h++; 171 | d = &src[y * src_width]; // (y * src_width - 1) + 1 172 | e0+=2; e1+=2; e2+=2; e3+=2; 173 | 174 | // normal case 175 | for (x=1; x<(src_width-1); x++) { 176 | rowColors[0] = *d; 177 | rowColors[1] = *e; 178 | rowColors[2] = *f; 179 | code = ( (*b == *f)<<0 | (*f == *h)<<1 | (*h == *d)<<2 | (*d == *b)<<3 ); 180 | *e0 = rowColors[lookup_map[0*16+code]]; 181 | *e1 = rowColors[lookup_map[1*16+code]]; 182 | *e2 = rowColors[lookup_map[2*16+code]]; 183 | *e3 = rowColors[lookup_map[3*16+code]]; 184 | b++; d++; e++; f++; h++; 185 | e0+=2; e1+=2; e2+=2; e3+=2; 186 | } 187 | 188 | // special right case - f is unknown 189 | rowColors[0] = *d; 190 | rowColors[1] = *e; 191 | rowColors[2] = *e; 192 | code = ( (*h == *d)<<2 | (*d == *b)<<3 ); 193 | *e0 = rowColors[lookup_map[0*16+code]]; 194 | *e1 = rowColors[lookup_map[1*16+code]]; 195 | *e2 = rowColors[lookup_map[2*16+code]]; 196 | *e3 = rowColors[lookup_map[3*16+code]]; 197 | } 198 | 199 | // special bottom case - h is always unknown 200 | { 201 | byte *b; 202 | byte *d; 203 | byte *e; 204 | byte *f; 205 | 206 | e0 = &dst[y*dst_width*2]; 207 | e1 = &dst[y*dst_width*2 + 1]; 208 | e2 = &dst[y*dst_width*2 + dst_width]; 209 | e3 = &dst[y*dst_width*2 + dst_width + 1]; 210 | b = &src[y * src_width - src_width]; 211 | e = &src[y * src_width]; 212 | f = &src[y * src_width + 1]; 213 | 214 | // special left case - d is unknown 215 | rowColors[0] = *e; 216 | rowColors[1] = *e; 217 | rowColors[2] = *f; 218 | code = ( (*b == *f)<<0 ); 219 | *e0 = rowColors[lookup_map[0*16+code]]; 220 | *e1 = rowColors[lookup_map[1*16+code]]; 221 | *e2 = rowColors[lookup_map[2*16+code]]; 222 | *e3 = rowColors[lookup_map[3*16+code]]; 223 | b++; e++; f++; 224 | d = &src[y * src_width]; // (y * src_width - 1) + 1 225 | e0+=2; e1+=2; e2+=2; e3+=2; 226 | 227 | // normal case 228 | for (x=1; x<(src_width-1); x++) { 229 | rowColors[0] = *d; 230 | rowColors[1] = *e; 231 | rowColors[2] = *f; 232 | code = ( (*b == *f)<<0 | (*d == *b)<<3 ); 233 | *e0 = rowColors[lookup_map[0*16+code]]; 234 | *e1 = rowColors[lookup_map[1*16+code]]; 235 | *e2 = rowColors[lookup_map[2*16+code]]; 236 | *e3 = rowColors[lookup_map[3*16+code]]; 237 | b++; d++; e++; f++; 238 | e0+=2; e1+=2; e2+=2; e3+=2; 239 | } 240 | 241 | // special right case - f is unknown 242 | rowColors[0] = *d; 243 | rowColors[1] = *e; 244 | rowColors[2] = *e; 245 | code = ( (*d == *b)<<3 ); 246 | *e0 = rowColors[lookup_map[0*16+code]]; 247 | *e1 = rowColors[lookup_map[1*16+code]]; 248 | *e2 = rowColors[lookup_map[2*16+code]]; 249 | *e3 = rowColors[lookup_map[3*16+code]]; 250 | } 251 | } 252 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.8) 2 | set(VERSION_MAJOR 1) 3 | set(VERSION_MINOR 02) 4 | 5 | if(BUILD_PSP2) 6 | if (NOT DEFINED CMAKE_TOOLCHAIN_FILE) 7 | if (DEFINED ENV{VITASDK}) 8 | set(CMAKE_TOOLCHAIN_FILE "$ENV{VITASDK}/share/vita.toolchain.cmake" CACHE PATH "toolchain file") 9 | else () 10 | message(FATAL_ERROR "Please define VITASDK to point to your SDK path!") 11 | endif () 12 | endif () 13 | endif () 14 | 15 | if(BUILD_NX) 16 | set(CMAKE_SYSTEM_NAME "Generic") 17 | set(DEVKITPRO $ENV{DEVKITPRO}) 18 | set(CMAKE_SYSTEM_PROCESSOR "armv8-a") 19 | set(CMAKE_C_COMPILER "${DEVKITPRO}/devkitA64/bin/aarch64-none-elf-gcc") 20 | set(CMAKE_CXX_COMPILER "${DEVKITPRO}/devkitA64/bin/aarch64-none-elf-g++") 21 | set(CMAKE_ASM_COMPILER "${DEVKITPRO}/devkitA64/bin/aarch64-none-elf-as") 22 | set(CMAKE_AR "${DEVKITPRO}/devkitA64/bin/aarch64-none-elf-gcc-ar" CACHE STRING "") 23 | set(CMAKE_RANLIB "${DEVKITPRO}/devkitA64/bin/aarch64-none-elf-gcc-ranlib" CACHE STRING "") 24 | set(CMAKE_FIND_ROOT_PATH ${DEVKITPRO} ${DEVKITPRO}/devkitA64 ${DEVKITPRO}/libnx ${DEVKITPRO}/portlibs/switch) 25 | set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) 26 | set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) 27 | set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) 28 | set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) 29 | set(BUILD_SHARED_LIBS OFF CACHE INTERNAL "Shared libs not available") 30 | link_directories(${DEVKITPRO}/libnx/lib ${DEVKITPRO}/portlibs/switch/lib) 31 | endif(BUILD_NX) 32 | 33 | project(jumpnbump C) 34 | 35 | aux_source_directory(. SRC_LIST) 36 | aux_source_directory(sdl SRC_LIST) 37 | add_custom_command(OUTPUT version.h 38 | COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/generate_version_h.sh 39 | DEPENDS VERSION) 40 | add_custom_command(OUTPUT jumpbump_dat.c 41 | COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/generate_jumpbump_dat.sh 42 | COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/generate_jumpbump_dat_c.sh 43 | ) 44 | 45 | if(BUILD_PSP2) 46 | include("${VITASDK}/share/vita.cmake" REQUIRED) 47 | set(TITLEID "JUMPNBUMP") 48 | include_directories( 49 | ${VITASDK}/arm-vita-eabi/include/ 50 | ${VITASDK}/arm-vita-eabi/include/SDL2 51 | ${CMAKE_CURRENT_SOURCE_DIR} 52 | ) 53 | set(LDFLAGS 54 | SDL2_mixer 55 | SDL2 56 | # SDL2_net 57 | vorbisfile 58 | vorbis 59 | ogg 60 | mikmod 61 | mpg123 62 | flac 63 | vita2d 64 | SceSysmodule_stub SceDisplay_stub SceGxm_stub SceAppUtil_stub 65 | SceCtrl_stub ScePgf_stub ScePower_stub SceCommonDialog_stub 66 | SceAudio_stub SceShellSvc_stub 67 | # SceNet_stub 68 | # SceNetCtl_stub 69 | SceHid_stub 70 | SceTouch_stub 71 | png jpeg z m c 72 | ) 73 | set(FLAGS 74 | -DNO_SDL_NET 75 | -D__PSP2__ 76 | -std=c++11 77 | -std=c11 78 | -Wno-write-strings 79 | #Note: using -Os, -O1, -O2, or -O3 all cause crash on Vita when jumping out of the top of the screen 80 | #to the left (!?!) 81 | -marm -mfpu=neon -mcpu=cortex-a9 -march=armv7-a -mfloat-abi=hard -ffast-math 82 | -fno-asynchronous-unwind-tables -funroll-loops 83 | -mword-relocations -fno-unwind-tables -fno-optimize-sibling-calls 84 | -mvectorize-with-neon-quad 85 | -mlittle-endian -munaligned-access 86 | ) 87 | add_executable(${PROJECT_NAME} ${SRC_LIST} jumpbump_dat.c version.h) 88 | target_compile_options(${PROJECT_NAME} PRIVATE ${FLAGS}) 89 | target_link_libraries(${PROJECT_NAME} ${LDFLAGS}) 90 | 91 | vita_create_self(${PROJECT_NAME}.self ${PROJECT_NAME} ${UNSAFE_FLAG}) 92 | add_custom_target(${PROJECT_NAME}.vpk 93 | DEPENDS ${PROJECT_NAME}.self 94 | COMMAND rm -rf vpk && mkdir -p vpk/sce_sys 95 | COMMAND ${VITASDK}/bin/vita-mksfoex -s TITLE_ID=${TITLEID} "${PROJECT_NAME}" vpk/sce_sys/param.sfo 96 | COMMAND cp ${PROJECT_NAME}.self vpk/eboot.bin 97 | COMMAND cp -r ${CMAKE_SOURCE_DIR}/psp2data/* vpk 98 | # COMMAND cp -r ${CMAKE_SOURCE_DIR}/data vpk/data 99 | COMMAND cd vpk && zip -r ../${PROJECT_NAME}_${VERSION_MAJOR}.${VERSION_MINOR}.vpk . && cd .. 100 | COMMAND zip -d ${PROJECT_NAME}_${VERSION_MAJOR}.${VERSION_MINOR}.vpk *.DS_Store 101 | COMMAND zip -d ${PROJECT_NAME}_${VERSION_MAJOR}.${VERSION_MINOR}.vpk *__MAC* 102 | ) 103 | elseif(BUILD_NX) 104 | include_directories( 105 | ${DEVKITPRO}/portlibs/switch/include/SDL2 106 | ${DEVKITPRO}/libnx/include 107 | ${DEVKITPRO}/portlibs/switch/include 108 | ${CMAKE_CURRENT_SOURCE_DIR} 109 | ) 110 | 111 | set(FLAGS 112 | -DNO_SDL_NET 113 | -D__SWITCH__ 114 | -std=gnu++11 115 | -std=gnu11 116 | -Wno-write-strings 117 | -march=armv8-a+crc+crypto 118 | -mtune=cortex-a57 119 | -mtp=soft 120 | #-fPIE is neccessary to prevent crash on startup 121 | -fPIE 122 | -fno-asynchronous-unwind-tables 123 | -funroll-loops 124 | -fno-unwind-tables 125 | -fno-optimize-sibling-calls 126 | -funsafe-math-optimizations 127 | -mlittle-endian 128 | -ffunction-sections 129 | -fcommon 130 | -fno-rtti 131 | -fno-exceptions 132 | -O2 133 | ) 134 | set(LIBS 135 | SDL2_mixer 136 | # SDL2_net 137 | SDL2 138 | EGL 139 | GLESv2 140 | glapi 141 | drm_nouveau 142 | png 143 | jpeg 144 | vorbisidec 145 | ogg 146 | modplug 147 | opusfile 148 | opus 149 | mpg123 150 | flac 151 | z 152 | m 153 | nx 154 | stdc++ 155 | ) 156 | foreach(flag ${FLAGS}) 157 | set(FLAGS_GENERAL "${FLAGS_GENERAL} ${flag}") 158 | endforeach(flag ${FLAGS}) 159 | 160 | #set(CMAKE_C_FLAGS "${FLAGS_GENERAL}" CACHE STRING "C Flags" FORCE) 161 | #set(CMAKE_CXX_FLAGS "${FLAGS_GENERAL}" CACHE STRING "C++ Flags" FORCE) 162 | 163 | set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${FLAGS_GENERAL} -specs=${DEVKITPRO}/libnx/switch.specs --verbose") 164 | 165 | add_executable(${PROJECT_NAME}.elf ${SRC_LIST} jumpbump_dat.c version.h) 166 | target_compile_options(${PROJECT_NAME}.elf PRIVATE ${FLAGS}) 167 | target_link_libraries(${PROJECT_NAME}.elf PRIVATE ${LIBS}) 168 | add_custom_target(${PROJECT_NAME}.nro 169 | DEPENDS ${PROJECT_NAME}.elf 170 | COMMAND ${DEVKITPRO}/tools/bin/nacptool --create "${PROJECT_NAME}" "rsn8887" "${VERSION_MAJOR}.${VERSION_MINOR}" ${PROJECT_NAME}.nacp 171 | COMMAND ${DEVKITPRO}/tools/bin/elf2nro ${PROJECT_NAME}.elf ${PROJECT_NAME}.nro --icon=${CMAKE_SOURCE_DIR}/switchdata/icon0.jpg --nacp=${PROJECT_NAME}.nacp 172 | ) 173 | add_custom_target(${PROJECT_NAME}_switch.zip 174 | DEPENDS ${PROJECT_NAME}.nro 175 | COMMAND rm -rf ${CMAKE_BINARY_DIR}/release/${PROJECT_NAME} 176 | COMMAND mkdir -p ${CMAKE_BINARY_DIR}/release/${PROJECT_NAME} 177 | COMMAND cp -f ${CMAKE_BINARY_DIR}/${PROJECT_NAME}.nro ${CMAKE_BINARY_DIR}/release/${PROJECT_NAME}/${PROJECT_NAME}.nro 178 | # COMMAND unzip ${CMAKE_SOURCE_DIR}/switchdata/data.zip -d${CMAKE_BINARY_DIR}/release/ 179 | COMMAND cd ${CMAKE_BINARY_DIR}/release && zip -r ../${PROJECT_NAME}_${VERSION_MAJOR}.${VERSION_MINOR}_switch.zip ${PROJECT_NAME} && cd ${CMAKE_BINARY_DIR} 180 | COMMAND zip -d ${PROJECT_NAME}_${VERSION_MAJOR}.${VERSION_MINOR}_switch.zip *.DS_Store 181 | COMMAND zip -d ${PROJECT_NAME}_${VERSION_MAJOR}.${VERSION_MINOR}_switch.zip *__MAC* 182 | ) 183 | else() 184 | include(FindPkgConfig) 185 | pkg_check_modules(SDL REQUIRED sdl2) 186 | pkg_check_modules(SDL_MIXER SDL2_mixer) 187 | pkg_check_modules(SDL_NET SDL2_net) 188 | if(NOT SDL_MIXER_FOUND) 189 | add_definitions(-DNO_SDL_MIXER) 190 | endif() 191 | if(NOT SDL_NET_FOUND) 192 | add_definitions(-DNO_SDL_NET) 193 | endif() 194 | include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} SYSTEM ${SDL_INCLUDE_DIRS} ${SDL_MIXER_INCLUDE_DIRS}) 195 | link_directories(${SDL_LIBRARY_DIRS} ${SDL_MIXER_LIBRARY_DIRS}) 196 | string (REPLACE ";" " " SDL_STATIC_LDFLAGS_STR "${SDL_STATIC_LDFLAGS} ${SDL_MIXER_STATIC_LDFLAGS} ${SDL_NET_STATIC_LDFLAGS}") 197 | set(CMAKE_EXE_LINKER_FLAGS "${SDL_STATIC_LDFLAGS_STR}") 198 | add_executable(${PROJECT_NAME} ${SRC_LIST} jumpbump_dat.c version.h) 199 | target_link_libraries(${PROJECT_NAME} m ${SDL_LIBRARIES} ${SDL_MIXER_LIBRARIES}) 200 | endif() 201 | 202 | -------------------------------------------------------------------------------- /data/rabbit.txt: -------------------------------------------------------------------------------- 1 | num_images: 72 2 | 3 | image: 1 4 | x: 0 5 | y: 0 6 | width: 13 7 | height: 15 8 | hotspot_x: -2 9 | hotspot_y: -1 10 | 11 | image: 2 12 | x: 19 13 | y: 0 14 | width: 14 15 | height: 14 16 | hotspot_x: -2 17 | hotspot_y: 0 18 | 19 | image: 3 20 | x: 38 21 | y: 0 22 | width: 14 23 | height: 16 24 | hotspot_x: -2 25 | hotspot_y: 2 26 | 27 | image: 4 28 | x: 57 29 | y: 0 30 | width: 13 31 | height: 16 32 | hotspot_x: -3 33 | hotspot_y: 2 34 | 35 | image: 5 36 | x: 76 37 | y: 0 38 | width: 14 39 | height: 14 40 | hotspot_x: -3 41 | hotspot_y: -2 42 | 43 | image: 6 44 | x: 95 45 | y: 0 46 | width: 15 47 | height: 14 48 | hotspot_x: -1 49 | hotspot_y: 0 50 | 51 | image: 7 52 | x: 114 53 | y: 0 54 | width: 16 55 | height: 16 56 | hotspot_x: 0 57 | hotspot_y: 0 58 | 59 | image: 8 60 | x: 133 61 | y: 0 62 | width: 17 63 | height: 16 64 | hotspot_x: 1 65 | hotspot_y: 0 66 | 67 | image: 9 68 | x: 152 69 | y: 0 70 | width: 17 71 | height: 13 72 | hotspot_x: -1 73 | hotspot_y: -3 74 | 75 | image: 10 76 | x: 171 77 | y: 0 78 | width: 13 79 | height: 15 80 | hotspot_x: -1 81 | hotspot_y: -1 82 | 83 | image: 11 84 | x: 190 85 | y: 0 86 | width: 14 87 | height: 14 88 | hotspot_x: 0 89 | hotspot_y: 0 90 | 91 | image: 12 92 | x: 209 93 | y: 0 94 | width: 14 95 | height: 16 96 | hotspot_x: 0 97 | hotspot_y: 2 98 | 99 | image: 13 100 | x: 228 101 | y: 0 102 | width: 13 103 | height: 16 104 | hotspot_x: 0 105 | hotspot_y: 2 106 | 107 | image: 14 108 | x: 247 109 | y: 0 110 | width: 14 111 | height: 14 112 | hotspot_x: 1 113 | hotspot_y: -1 114 | 115 | image: 15 116 | x: 266 117 | y: 0 118 | width: 15 119 | height: 14 120 | hotspot_x: 0 121 | hotspot_y: 1 122 | 123 | image: 16 124 | x: 285 125 | y: 0 126 | width: 16 127 | height: 16 128 | hotspot_x: 0 129 | hotspot_y: 2 130 | 131 | image: 17 132 | x: 304 133 | y: 0 134 | width: 17 135 | height: 16 136 | hotspot_x: 0 137 | hotspot_y: 2 138 | 139 | image: 18 140 | x: 323 141 | y: 0 142 | width: 17 143 | height: 13 144 | hotspot_x: 2 145 | hotspot_y: -4 146 | 147 | image: 19 148 | x: 342 149 | y: 0 150 | width: 13 151 | height: 15 152 | hotspot_x: -2 153 | hotspot_y: -1 154 | 155 | image: 20 156 | x: 361 157 | y: 0 158 | width: 14 159 | height: 14 160 | hotspot_x: -2 161 | hotspot_y: 0 162 | 163 | image: 21 164 | x: 380 165 | y: 0 166 | width: 14 167 | height: 16 168 | hotspot_x: -2 169 | hotspot_y: 2 170 | 171 | image: 22 172 | x: 0 173 | y: 18 174 | width: 13 175 | height: 16 176 | hotspot_x: -3 177 | hotspot_y: 2 178 | 179 | image: 23 180 | x: 19 181 | y: 18 182 | width: 14 183 | height: 14 184 | hotspot_x: -3 185 | hotspot_y: -2 186 | 187 | image: 24 188 | x: 38 189 | y: 18 190 | width: 15 191 | height: 14 192 | hotspot_x: -1 193 | hotspot_y: 0 194 | 195 | image: 25 196 | x: 57 197 | y: 18 198 | width: 16 199 | height: 16 200 | hotspot_x: 0 201 | hotspot_y: 0 202 | 203 | image: 26 204 | x: 76 205 | y: 18 206 | width: 17 207 | height: 16 208 | hotspot_x: 1 209 | hotspot_y: 0 210 | 211 | image: 27 212 | x: 95 213 | y: 18 214 | width: 17 215 | height: 13 216 | hotspot_x: -1 217 | hotspot_y: -3 218 | 219 | image: 28 220 | x: 114 221 | y: 18 222 | width: 13 223 | height: 15 224 | hotspot_x: -1 225 | hotspot_y: -1 226 | 227 | image: 29 228 | x: 133 229 | y: 18 230 | width: 14 231 | height: 14 232 | hotspot_x: 0 233 | hotspot_y: 0 234 | 235 | image: 30 236 | x: 152 237 | y: 18 238 | width: 14 239 | height: 16 240 | hotspot_x: 0 241 | hotspot_y: 2 242 | 243 | image: 31 244 | x: 171 245 | y: 18 246 | width: 13 247 | height: 16 248 | hotspot_x: 0 249 | hotspot_y: 2 250 | 251 | image: 32 252 | x: 190 253 | y: 18 254 | width: 14 255 | height: 14 256 | hotspot_x: 1 257 | hotspot_y: -1 258 | 259 | image: 33 260 | x: 209 261 | y: 18 262 | width: 15 263 | height: 14 264 | hotspot_x: 0 265 | hotspot_y: 1 266 | 267 | image: 34 268 | x: 228 269 | y: 18 270 | width: 16 271 | height: 16 272 | hotspot_x: 0 273 | hotspot_y: 2 274 | 275 | image: 35 276 | x: 247 277 | y: 18 278 | width: 17 279 | height: 16 280 | hotspot_x: 0 281 | hotspot_y: 2 282 | 283 | image: 36 284 | x: 266 285 | y: 18 286 | width: 17 287 | height: 13 288 | hotspot_x: 2 289 | hotspot_y: -4 290 | 291 | image: 37 292 | x: 285 293 | y: 18 294 | width: 13 295 | height: 15 296 | hotspot_x: -2 297 | hotspot_y: -1 298 | 299 | image: 38 300 | x: 304 301 | y: 18 302 | width: 14 303 | height: 14 304 | hotspot_x: -2 305 | hotspot_y: 0 306 | 307 | image: 39 308 | x: 323 309 | y: 18 310 | width: 14 311 | height: 16 312 | hotspot_x: -2 313 | hotspot_y: 2 314 | 315 | image: 40 316 | x: 342 317 | y: 18 318 | width: 13 319 | height: 16 320 | hotspot_x: -3 321 | hotspot_y: 2 322 | 323 | image: 41 324 | x: 361 325 | y: 18 326 | width: 14 327 | height: 14 328 | hotspot_x: -3 329 | hotspot_y: -2 330 | 331 | image: 42 332 | x: 380 333 | y: 18 334 | width: 15 335 | height: 14 336 | hotspot_x: -1 337 | hotspot_y: 0 338 | 339 | image: 43 340 | x: 0 341 | y: 36 342 | width: 16 343 | height: 16 344 | hotspot_x: 0 345 | hotspot_y: 0 346 | 347 | image: 44 348 | x: 19 349 | y: 36 350 | width: 17 351 | height: 16 352 | hotspot_x: 1 353 | hotspot_y: 0 354 | 355 | image: 45 356 | x: 38 357 | y: 36 358 | width: 17 359 | height: 13 360 | hotspot_x: -1 361 | hotspot_y: -3 362 | 363 | image: 46 364 | x: 57 365 | y: 36 366 | width: 13 367 | height: 15 368 | hotspot_x: -1 369 | hotspot_y: -1 370 | 371 | image: 47 372 | x: 76 373 | y: 36 374 | width: 14 375 | height: 14 376 | hotspot_x: 0 377 | hotspot_y: 0 378 | 379 | image: 48 380 | x: 95 381 | y: 36 382 | width: 14 383 | height: 16 384 | hotspot_x: 0 385 | hotspot_y: 2 386 | 387 | image: 49 388 | x: 114 389 | y: 36 390 | width: 13 391 | height: 16 392 | hotspot_x: 0 393 | hotspot_y: 2 394 | 395 | image: 50 396 | x: 133 397 | y: 36 398 | width: 14 399 | height: 14 400 | hotspot_x: 1 401 | hotspot_y: -1 402 | 403 | image: 51 404 | x: 152 405 | y: 36 406 | width: 15 407 | height: 14 408 | hotspot_x: 0 409 | hotspot_y: 1 410 | 411 | image: 52 412 | x: 171 413 | y: 36 414 | width: 16 415 | height: 16 416 | hotspot_x: 0 417 | hotspot_y: 2 418 | 419 | image: 53 420 | x: 190 421 | y: 36 422 | width: 17 423 | height: 16 424 | hotspot_x: 0 425 | hotspot_y: 2 426 | 427 | image: 54 428 | x: 209 429 | y: 36 430 | width: 17 431 | height: 13 432 | hotspot_x: 2 433 | hotspot_y: -4 434 | 435 | image: 55 436 | x: 228 437 | y: 36 438 | width: 13 439 | height: 15 440 | hotspot_x: -2 441 | hotspot_y: -1 442 | 443 | image: 56 444 | x: 247 445 | y: 36 446 | width: 14 447 | height: 14 448 | hotspot_x: -2 449 | hotspot_y: -1 450 | 451 | image: 57 452 | x: 266 453 | y: 36 454 | width: 14 455 | height: 16 456 | hotspot_x: -2 457 | hotspot_y: 2 458 | 459 | image: 58 460 | x: 285 461 | y: 36 462 | width: 13 463 | height: 16 464 | hotspot_x: -3 465 | hotspot_y: 2 466 | 467 | image: 59 468 | x: 304 469 | y: 36 470 | width: 14 471 | height: 14 472 | hotspot_x: -3 473 | hotspot_y: -2 474 | 475 | image: 60 476 | x: 323 477 | y: 36 478 | width: 15 479 | height: 14 480 | hotspot_x: -1 481 | hotspot_y: 0 482 | 483 | image: 61 484 | x: 342 485 | y: 36 486 | width: 16 487 | height: 16 488 | hotspot_x: 0 489 | hotspot_y: 0 490 | 491 | image: 62 492 | x: 361 493 | y: 36 494 | width: 17 495 | height: 16 496 | hotspot_x: 1 497 | hotspot_y: 0 498 | 499 | image: 63 500 | x: 380 501 | y: 36 502 | width: 17 503 | height: 13 504 | hotspot_x: -1 505 | hotspot_y: -3 506 | 507 | image: 64 508 | x: 0 509 | y: 54 510 | width: 13 511 | height: 15 512 | hotspot_x: -1 513 | hotspot_y: -1 514 | 515 | image: 65 516 | x: 19 517 | y: 54 518 | width: 14 519 | height: 14 520 | hotspot_x: 0 521 | hotspot_y: 0 522 | 523 | image: 66 524 | x: 38 525 | y: 54 526 | width: 14 527 | height: 16 528 | hotspot_x: 0 529 | hotspot_y: 2 530 | 531 | image: 67 532 | x: 57 533 | y: 54 534 | width: 13 535 | height: 16 536 | hotspot_x: 0 537 | hotspot_y: 2 538 | 539 | image: 68 540 | x: 76 541 | y: 54 542 | width: 14 543 | height: 14 544 | hotspot_x: 1 545 | hotspot_y: -1 546 | 547 | image: 69 548 | x: 95 549 | y: 54 550 | width: 15 551 | height: 14 552 | hotspot_x: 0 553 | hotspot_y: 1 554 | 555 | image: 70 556 | x: 114 557 | y: 54 558 | width: 16 559 | height: 16 560 | hotspot_x: 0 561 | hotspot_y: 2 562 | 563 | image: 71 564 | x: 133 565 | y: 54 566 | width: 17 567 | height: 16 568 | hotspot_x: 0 569 | hotspot_y: 2 570 | 571 | image: 72 572 | x: 152 573 | y: 54 574 | width: 17 575 | height: 13 576 | hotspot_x: 2 577 | hotspot_y: -4 578 | 579 | -------------------------------------------------------------------------------- /fireworks.c: -------------------------------------------------------------------------------- 1 | /* 2 | * fireworks.c 3 | * Copyright (C) 1998 Brainchild Design - http://brainchilddesign.com/ 4 | * 5 | * Copyright (C) 2001 Chuck Mason 6 | * 7 | * Copyright (C) 2002 Florian Schulze 8 | * 9 | * This file is part of Jump'n'Bump. 10 | * 11 | * Jump'n'Bump is free software; you can redistribute it and/or modify 12 | * it under the terms of the GNU General Public License as published by 13 | * the Free Software Foundation; either version 2 of the License, or 14 | * (at your option) any later version. 15 | * 16 | * Jump'n'Bump is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU General Public License for more details. 20 | * 21 | * You should have received a copy of the GNU General Public License 22 | * along with this program; if not, write to the Free Software 23 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 24 | */ 25 | 26 | #include "globals.h" 27 | 28 | extern unsigned int ban_map[17][22]; 29 | 30 | void fireworks(void) 31 | { 32 | unsigned char *handle; 33 | int c1, c2; 34 | int s1, s2, s3; 35 | char pal[768]; 36 | struct { 37 | int used, direction, colour; 38 | int x, y; 39 | int x_add, y_add; 40 | int timer; 41 | int anim, frame, frame_tick, image; 42 | } rabbits[20]; 43 | struct { 44 | int x, y; 45 | int old_x, old_y; 46 | int col; 47 | int back[2]; 48 | } stars[300]; 49 | 50 | register_background(NULL, NULL); 51 | 52 | if ((handle = dat_open("level.pcx")) == 0) { 53 | strcpy(main_info.error_str, "Error loading 'level.pcx', aborting...\n"); 54 | return; 55 | } 56 | read_pcx(handle, mask_pic, JNB_WIDTH*JNB_HEIGHT, pal); 57 | 58 | memset(mask_pic, 0, JNB_WIDTH*JNB_HEIGHT); 59 | register_mask(mask_pic); 60 | 61 | memset(ban_map, 0, sizeof(ban_map)); 62 | 63 | fillpalette(0, 0, 0); 64 | 65 | draw_begin(); 66 | 67 | for (c2 = JNB_HEIGHT - 63; c2 < JNB_HEIGHT; c2++) { 68 | clear_lines(0, c2, 1, get_color((c2 - 192) >> 2, pal)); 69 | clear_lines(1, c2, 1, get_color((c2 - 192) >> 2, pal)); 70 | } 71 | 72 | draw_end(); 73 | 74 | setpalette(0, 256, pal); 75 | 76 | for (c1 = 0; c1 < 20; c1++) 77 | rabbits[c1].used = 0; 78 | 79 | rabbits[0].used = 1; 80 | rabbits[0].colour = rnd(4); 81 | rabbits[0].x = (int) (150 + rnd(100)) << 16; 82 | rabbits[0].y = 256 << 16; 83 | rabbits[0].x_add = ((int) rnd(65535) << 1) - 65536; 84 | if (rabbits[0].x_add > 0) 85 | rabbits[0].direction = 0; 86 | else 87 | rabbits[0].direction = 1; 88 | rabbits[0].y_add = -262144 + (rnd(16384) * 5); 89 | rabbits[0].timer = 30 + rnd(150); 90 | rabbits[0].anim = 2; 91 | rabbits[0].frame = 0; 92 | rabbits[0].frame_tick = 0; 93 | rabbits[0].image = player_anims[rabbits[0].anim].frame[rabbits[0].frame].image + rabbits[0].colour * 18 + rabbits[0].direction * 9; 94 | 95 | draw_begin(); 96 | for (c1 = 0; c1 < 300; c1++) { 97 | s1 = rnd(JNB_WIDTH); 98 | s2 = rnd(JNB_HEIGHT); 99 | s3 = 30 - rnd(7); 100 | stars[c1].x = stars[c1].old_x = (s1 << 16); 101 | stars[c1].y = stars[c1].old_y = (s2 << 16); 102 | stars[c1].col = s3; 103 | stars[c1].back[0] = stars[c1].back[1] = get_pixel(0, s1, s2); 104 | } 105 | draw_end(); 106 | 107 | main_info.page_info[0].num_pobs = 0; 108 | main_info.page_info[1].num_pobs = 0; 109 | main_info.view_page = 0; 110 | main_info.draw_page = 1; 111 | 112 | while (key_pressed(1) == 0) { 113 | 114 | dj_mix(); 115 | intr_sysupdate(); 116 | 117 | for (c1 = 0; c1 < 300; c1++) { 118 | stars[c1].old_x = stars[c1].x; 119 | stars[c1].old_y = stars[c1].y; 120 | stars[c1].y -= (int) (31 - stars[c1].col) * 16384; 121 | if ((stars[c1].y >> 16) < 0) 122 | stars[c1].y += JNB_HEIGHT << 16; 123 | if ((stars[c1].y >> 16) >= JNB_HEIGHT) 124 | stars[c1].y -= JNB_HEIGHT << 16; 125 | } 126 | 127 | for (c1 = 0, c2 = 0; c1 < 20; c1++) { 128 | if (rabbits[c1].used == 1) 129 | c2++; 130 | } 131 | if ((c2 == 0 && rnd(10000) < 200) || (c2 == 1 && rnd(10000) < 150) || (c2 == 2 && rnd(10000) < 100) || (c2 == 3 && rnd(10000) < 50)) { 132 | for (c1 = 0; c1 < 20; c1++) { 133 | if (rabbits[c1].used == 0) { 134 | rabbits[c1].used = 1; 135 | rabbits[c1].colour = rnd(4); 136 | rabbits[c1].x = (int) (150 + rnd(100)) << 16; 137 | rabbits[c1].y = 256 << 16; 138 | rabbits[c1].x_add = ((int) rnd(65535) << 1) - 65536; 139 | if (rabbits[c1].x_add > 0) 140 | rabbits[c1].direction = 0; 141 | else 142 | rabbits[c1].direction = 1; 143 | rabbits[c1].y_add = -262144 + (rnd(16384) * 5); 144 | rabbits[c1].timer = 30 + rnd(150); 145 | rabbits[c1].anim = 2; 146 | rabbits[c1].frame = 0; 147 | rabbits[c1].frame_tick = 0; 148 | rabbits[c1].image = player_anims[rabbits[c1].anim].frame[rabbits[c1].frame].image + rabbits[c1].colour * 18 + rabbits[c1].direction * 9; 149 | break; 150 | } 151 | } 152 | } 153 | 154 | dj_mix(); 155 | 156 | main_info.page_info[main_info.draw_page].num_pobs = 0; 157 | 158 | for (c1 = 0; c1 < 20; c1++) { 159 | if (rabbits[c1].used == 1) { 160 | rabbits[c1].y_add += 2048; 161 | if (rabbits[c1].y_add > 36864 && rabbits[c1].anim != 3) { 162 | rabbits[c1].anim = 3; 163 | rabbits[c1].frame = 0; 164 | rabbits[c1].frame_tick = 0; 165 | rabbits[c1].image = player_anims[rabbits[c1].anim].frame[rabbits[c1].frame].image + rabbits[c1].colour * 18 + rabbits[c1].direction * 9; 166 | } 167 | rabbits[c1].x += rabbits[c1].x_add; 168 | rabbits[c1].y += rabbits[c1].y_add; 169 | if ((rabbits[c1].x >> 16) < 16 || (rabbits[c1].x >> 16) > JNB_WIDTH || (rabbits[c1].y >> 16) > JNB_HEIGHT) { 170 | rabbits[c1].used = 0; 171 | continue; 172 | } 173 | rabbits[c1].timer--; 174 | if (rabbits[c1].timer <= 0) { 175 | rabbits[c1].used = 0; 176 | for (c2 = 0; c2 < 6; c2++) 177 | add_object(OBJ_FUR, (rabbits[c1].x >> 16) + 6 + rnd(5), (rabbits[c1].y >> 16) + 6 + rnd(5), rabbits[c1].x_add + (rnd(65535) - 32768) * 3, rabbits[c1].y_add + (rnd(65535) - 32768) * 3, 0, 44 + rabbits[c1].colour * 8); 178 | for (c2 = 0; c2 < 6; c2++) 179 | add_object(OBJ_FLESH, (rabbits[c1].x >> 16) + 6 + rnd(5), (rabbits[c1].y >> 16) + 6 + rnd(5), rabbits[c1].x_add + (rnd(65535) - 32768) * 3, rabbits[c1].y_add + (rnd(65535) - 32768) * 3, 0, 76); 180 | for (c2 = 0; c2 < 6; c2++) 181 | add_object(OBJ_FLESH, (rabbits[c1].x >> 16) + 6 + rnd(5), (rabbits[c1].y >> 16) + 6 + rnd(5), rabbits[c1].x_add + (rnd(65535) - 32768) * 3, rabbits[c1].y_add + (rnd(65535) - 32768) * 3, 0, 77); 182 | for (c2 = 0; c2 < 8; c2++) 183 | add_object(OBJ_FLESH, (rabbits[c1].x >> 16) + 6 + rnd(5), (rabbits[c1].y >> 16) + 6 + rnd(5), rabbits[c1].x_add + (rnd(65535) - 32768) * 3, rabbits[c1].y_add + (rnd(65535) - 32768) * 3, 0, 78); 184 | for (c2 = 0; c2 < 10; c2++) 185 | add_object(OBJ_FLESH, (rabbits[c1].x >> 16) + 6 + rnd(5), (rabbits[c1].y >> 16) + 6 + rnd(5), rabbits[c1].x_add + (rnd(65535) - 32768) * 3, rabbits[c1].y_add + (rnd(65535) - 32768) * 3, 0, 79); 186 | dj_play_sfx(SFX_DEATH, SFX_DEATH_FREQ, 64, -1); 187 | continue; 188 | } 189 | rabbits[c1].frame_tick++; 190 | if (rabbits[c1].frame_tick >= player_anims[rabbits[c1].anim].frame[rabbits[c1].frame].ticks) { 191 | rabbits[c1].frame++; 192 | if (rabbits[c1].frame >= player_anims[rabbits[c1].anim].num_frames) 193 | rabbits[c1].frame = player_anims[rabbits[c1].anim].restart_frame; 194 | rabbits[c1].frame_tick = 0; 195 | } 196 | rabbits[c1].image = player_anims[rabbits[c1].anim].frame[rabbits[c1].frame].image + rabbits[c1].colour * 18 + rabbits[c1].direction * 9; 197 | if (rabbits[c1].used == 1) 198 | add_pob(main_info.draw_page, rabbits[c1].x >> 16, rabbits[c1].y >> 16, rabbits[c1].image, &rabbit_gobs); 199 | } 200 | } 201 | 202 | dj_mix(); 203 | 204 | update_objects(); 205 | 206 | draw_begin(); 207 | 208 | for (c1 = 0; c1 < 300; c1++) { 209 | stars[c1].back[main_info.draw_page] = get_pixel(main_info.draw_page, stars[c1].x >> 16, stars[c1].y >> 16); 210 | set_pixel(main_info.draw_page, stars[c1].x >> 16, stars[c1].y >> 16, get_color(stars[c1].col, pal)); 211 | } 212 | 213 | dj_mix(); 214 | 215 | draw_pobs(main_info.draw_page); 216 | 217 | draw_end(); 218 | 219 | main_info.draw_page ^= 1; 220 | main_info.view_page ^= 1; 221 | 222 | flippage(main_info.view_page); 223 | 224 | wait_vrt(1); 225 | 226 | draw_begin(); 227 | 228 | redraw_pob_backgrounds(main_info.draw_page); 229 | 230 | dj_mix(); 231 | intr_sysupdate(); 232 | 233 | for (c1 = 299; c1 >= 0; c1--) { 234 | set_pixel(main_info.draw_page, stars[c1].old_x >> 16, stars[c1].old_y >> 16, stars[c1].back[main_info.draw_page]); 235 | } 236 | 237 | draw_end(); 238 | 239 | } 240 | 241 | } 242 | 243 | -------------------------------------------------------------------------------- /data/objects.txt: -------------------------------------------------------------------------------- 1 | num_images: 80 2 | 3 | image: 1 4 | x: 0 5 | y: 0 6 | width: 17 7 | height: 7 8 | hotspot_x: 0 9 | hotspot_y: 3 10 | 11 | image: 2 12 | x: 32 13 | y: 0 14 | width: 17 15 | height: 8 16 | hotspot_x: 0 17 | hotspot_y: 4 18 | 19 | image: 3 20 | x: 64 21 | y: 0 22 | width: 17 23 | height: 12 24 | hotspot_x: 0 25 | hotspot_y: 8 26 | 27 | image: 4 28 | x: 96 29 | y: 0 30 | width: 17 31 | height: 10 32 | hotspot_x: 0 33 | hotspot_y: 6 34 | 35 | image: 5 36 | x: 128 37 | y: 0 38 | width: 17 39 | height: 8 40 | hotspot_x: 0 41 | hotspot_y: 4 42 | 43 | image: 6 44 | x: 160 45 | y: 0 46 | width: 17 47 | height: 7 48 | hotspot_x: 0 49 | hotspot_y: 3 50 | 51 | image: 7 52 | x: 192 53 | y: 0 54 | width: 12 55 | height: 6 56 | hotspot_x: 5 57 | hotspot_y: 5 58 | 59 | image: 8 60 | x: 224 61 | y: 0 62 | width: 16 63 | height: 8 64 | hotspot_x: 7 65 | hotspot_y: 7 66 | 67 | image: 9 68 | x: 256 69 | y: 0 70 | width: 20 71 | height: 10 72 | hotspot_x: 9 73 | hotspot_y: 9 74 | 75 | image: 10 76 | x: 288 77 | y: 0 78 | width: 23 79 | height: 11 80 | hotspot_x: 11 81 | hotspot_y: 10 82 | 83 | image: 11 84 | x: 320 85 | y: 0 86 | width: 25 87 | height: 12 88 | hotspot_x: 12 89 | hotspot_y: 11 90 | 91 | image: 12 92 | x: 352 93 | y: 0 94 | width: 27 95 | height: 11 96 | hotspot_x: 13 97 | hotspot_y: 10 98 | 99 | image: 13 100 | x: 0 101 | y: 14 102 | width: 29 103 | height: 10 104 | hotspot_x: 14 105 | hotspot_y: 8 106 | 107 | image: 14 108 | x: 32 109 | y: 14 110 | width: 30 111 | height: 7 112 | hotspot_x: 15 113 | hotspot_y: 5 114 | 115 | image: 15 116 | x: 64 117 | y: 14 118 | width: 29 119 | height: 4 120 | hotspot_x: 16 121 | hotspot_y: 2 122 | 123 | image: 16 124 | x: 96 125 | y: 14 126 | width: 2 127 | height: 2 128 | hotspot_x: 0 129 | hotspot_y: 0 130 | 131 | image: 17 132 | x: 128 133 | y: 14 134 | width: 4 135 | height: 4 136 | hotspot_x: 1 137 | hotspot_y: 1 138 | 139 | image: 18 140 | x: 160 141 | y: 14 142 | width: 5 143 | height: 5 144 | hotspot_x: 2 145 | hotspot_y: 2 146 | 147 | image: 19 148 | x: 192 149 | y: 14 150 | width: 5 151 | height: 5 152 | hotspot_x: 2 153 | hotspot_y: 2 154 | 155 | image: 20 156 | x: 224 157 | y: 14 158 | width: 5 159 | height: 5 160 | hotspot_x: 2 161 | hotspot_y: 2 162 | 163 | image: 21 164 | x: 256 165 | y: 14 166 | width: 7 167 | height: 5 168 | hotspot_x: 4 169 | hotspot_y: 4 170 | 171 | image: 22 172 | x: 288 173 | y: 14 174 | width: 8 175 | height: 4 176 | hotspot_x: 5 177 | hotspot_y: 3 178 | 179 | image: 23 180 | x: 320 181 | y: 14 182 | width: 9 183 | height: 3 184 | hotspot_x: 5 185 | hotspot_y: 2 186 | 187 | image: 24 188 | x: 352 189 | y: 14 190 | width: 8 191 | height: 3 192 | hotspot_x: 5 193 | hotspot_y: 1 194 | 195 | image: 25 196 | x: 0 197 | y: 28 198 | width: 8 199 | height: 4 200 | hotspot_x: 5 201 | hotspot_y: 1 202 | 203 | image: 26 204 | x: 32 205 | y: 28 206 | width: 7 207 | height: 5 208 | hotspot_x: 4 209 | hotspot_y: 1 210 | 211 | image: 27 212 | x: 64 213 | y: 28 214 | width: 7 215 | height: 5 216 | hotspot_x: 2 217 | hotspot_y: 4 218 | 219 | image: 28 220 | x: 96 221 | y: 28 222 | width: 8 223 | height: 4 224 | hotspot_x: 2 225 | hotspot_y: 3 226 | 227 | image: 29 228 | x: 128 229 | y: 28 230 | width: 9 231 | height: 3 232 | hotspot_x: 3 233 | hotspot_y: 2 234 | 235 | image: 30 236 | x: 160 237 | y: 28 238 | width: 8 239 | height: 3 240 | hotspot_x: 2 241 | hotspot_y: 1 242 | 243 | image: 31 244 | x: 192 245 | y: 28 246 | width: 8 247 | height: 4 248 | hotspot_x: 2 249 | hotspot_y: 1 250 | 251 | image: 32 252 | x: 224 253 | y: 28 254 | width: 7 255 | height: 5 256 | hotspot_x: 2 257 | hotspot_y: 1 258 | 259 | image: 33 260 | x: 256 261 | y: 28 262 | width: 7 263 | height: 5 264 | hotspot_x: 4 265 | hotspot_y: 4 266 | 267 | image: 34 268 | x: 288 269 | y: 28 270 | width: 8 271 | height: 4 272 | hotspot_x: 5 273 | hotspot_y: 3 274 | 275 | image: 35 276 | x: 320 277 | y: 28 278 | width: 9 279 | height: 3 280 | hotspot_x: 5 281 | hotspot_y: 2 282 | 283 | image: 36 284 | x: 352 285 | y: 28 286 | width: 8 287 | height: 3 288 | hotspot_x: 5 289 | hotspot_y: 1 290 | 291 | image: 37 292 | x: 0 293 | y: 42 294 | width: 8 295 | height: 4 296 | hotspot_x: 5 297 | hotspot_y: 1 298 | 299 | image: 38 300 | x: 32 301 | y: 42 302 | width: 7 303 | height: 5 304 | hotspot_x: 4 305 | hotspot_y: 1 306 | 307 | image: 39 308 | x: 64 309 | y: 42 310 | width: 7 311 | height: 5 312 | hotspot_x: 2 313 | hotspot_y: 4 314 | 315 | image: 40 316 | x: 96 317 | y: 42 318 | width: 8 319 | height: 4 320 | hotspot_x: 2 321 | hotspot_y: 3 322 | 323 | image: 41 324 | x: 128 325 | y: 42 326 | width: 9 327 | height: 3 328 | hotspot_x: 3 329 | hotspot_y: 2 330 | 331 | image: 42 332 | x: 160 333 | y: 42 334 | width: 8 335 | height: 3 336 | hotspot_x: 2 337 | hotspot_y: 1 338 | 339 | image: 43 340 | x: 192 341 | y: 42 342 | width: 8 343 | height: 4 344 | hotspot_x: 2 345 | hotspot_y: 1 346 | 347 | image: 44 348 | x: 224 349 | y: 42 350 | width: 7 351 | height: 5 352 | hotspot_x: 2 353 | hotspot_y: 1 354 | 355 | image: 45 356 | x: 256 357 | y: 42 358 | width: 6 359 | height: 4 360 | hotspot_x: 3 361 | hotspot_y: 2 362 | 363 | image: 46 364 | x: 288 365 | y: 42 366 | width: 6 367 | height: 5 368 | hotspot_x: 3 369 | hotspot_y: 3 370 | 371 | image: 47 372 | x: 320 373 | y: 42 374 | width: 4 375 | height: 6 376 | hotspot_x: 2 377 | hotspot_y: 3 378 | 379 | image: 48 380 | x: 352 381 | y: 42 382 | width: 5 383 | height: 6 384 | hotspot_x: 2 385 | hotspot_y: 3 386 | 387 | image: 49 388 | x: 0 389 | y: 56 390 | width: 6 391 | height: 4 392 | hotspot_x: 2 393 | hotspot_y: 2 394 | 395 | image: 50 396 | x: 32 397 | y: 56 398 | width: 6 399 | height: 5 400 | hotspot_x: 2 401 | hotspot_y: 2 402 | 403 | image: 51 404 | x: 64 405 | y: 56 406 | width: 4 407 | height: 6 408 | hotspot_x: 1 409 | hotspot_y: 2 410 | 411 | image: 52 412 | x: 96 413 | y: 56 414 | width: 5 415 | height: 6 416 | hotspot_x: 2 417 | hotspot_y: 3 418 | 419 | image: 53 420 | x: 128 421 | y: 56 422 | width: 6 423 | height: 4 424 | hotspot_x: 3 425 | hotspot_y: 2 426 | 427 | image: 54 428 | x: 160 429 | y: 56 430 | width: 6 431 | height: 5 432 | hotspot_x: 3 433 | hotspot_y: 2 434 | 435 | image: 55 436 | x: 192 437 | y: 56 438 | width: 4 439 | height: 6 440 | hotspot_x: 2 441 | hotspot_y: 3 442 | 443 | image: 56 444 | x: 224 445 | y: 56 446 | width: 5 447 | height: 6 448 | hotspot_x: 3 449 | hotspot_y: 3 450 | 451 | image: 57 452 | x: 256 453 | y: 56 454 | width: 6 455 | height: 4 456 | hotspot_x: 4 457 | hotspot_y: 2 458 | 459 | image: 58 460 | x: 288 461 | y: 56 462 | width: 6 463 | height: 5 464 | hotspot_x: 4 465 | hotspot_y: 3 466 | 467 | image: 59 468 | x: 320 469 | y: 56 470 | width: 4 471 | height: 6 472 | hotspot_x: 3 473 | hotspot_y: 3 474 | 475 | image: 60 476 | x: 352 477 | y: 56 478 | width: 5 479 | height: 6 480 | hotspot_x: 3 481 | hotspot_y: 3 482 | 483 | image: 61 484 | x: 0 485 | y: 70 486 | width: 6 487 | height: 4 488 | hotspot_x: 3 489 | hotspot_y: 2 490 | 491 | image: 62 492 | x: 32 493 | y: 70 494 | width: 6 495 | height: 5 496 | hotspot_x: 3 497 | hotspot_y: 2 498 | 499 | image: 63 500 | x: 64 501 | y: 70 502 | width: 4 503 | height: 6 504 | hotspot_x: 3 505 | hotspot_y: 2 506 | 507 | image: 64 508 | x: 96 509 | y: 70 510 | width: 5 511 | height: 6 512 | hotspot_x: 4 513 | hotspot_y: 2 514 | 515 | image: 65 516 | x: 128 517 | y: 70 518 | width: 6 519 | height: 4 520 | hotspot_x: 5 521 | hotspot_y: 1 522 | 523 | image: 66 524 | x: 160 525 | y: 70 526 | width: 6 527 | height: 5 528 | hotspot_x: 5 529 | hotspot_y: 2 530 | 531 | image: 67 532 | x: 192 533 | y: 70 534 | width: 4 535 | height: 6 536 | hotspot_x: 4 537 | hotspot_y: 3 538 | 539 | image: 68 540 | x: 224 541 | y: 70 542 | width: 5 543 | height: 6 544 | hotspot_x: 3 545 | hotspot_y: 3 546 | 547 | image: 69 548 | x: 256 549 | y: 70 550 | width: 6 551 | height: 4 552 | hotspot_x: 3 553 | hotspot_y: 2 554 | 555 | image: 70 556 | x: 288 557 | y: 70 558 | width: 6 559 | height: 5 560 | hotspot_x: 3 561 | hotspot_y: 2 562 | 563 | image: 71 564 | x: 320 565 | y: 70 566 | width: 4 567 | height: 6 568 | hotspot_x: 2 569 | hotspot_y: 2 570 | 571 | image: 72 572 | x: 352 573 | y: 70 574 | width: 5 575 | height: 6 576 | hotspot_x: 4 577 | hotspot_y: 2 578 | 579 | image: 73 580 | x: 0 581 | y: 84 582 | width: 6 583 | height: 4 584 | hotspot_x: 5 585 | hotspot_y: 1 586 | 587 | image: 74 588 | x: 32 589 | y: 84 590 | width: 6 591 | height: 5 592 | hotspot_x: 5 593 | hotspot_y: 2 594 | 595 | image: 75 596 | x: 64 597 | y: 84 598 | width: 4 599 | height: 6 600 | hotspot_x: 3 601 | hotspot_y: 3 602 | 603 | image: 76 604 | x: 96 605 | y: 84 606 | width: 5 607 | height: 6 608 | hotspot_x: 3 609 | hotspot_y: 3 610 | 611 | image: 77 612 | x: 128 613 | y: 84 614 | width: 5 615 | height: 4 616 | hotspot_x: 2 617 | hotspot_y: 1 618 | 619 | image: 78 620 | x: 160 621 | y: 84 622 | width: 4 623 | height: 4 624 | hotspot_x: 2 625 | hotspot_y: 1 626 | 627 | image: 79 628 | x: 192 629 | y: 84 630 | width: 2 631 | height: 3 632 | hotspot_x: 1 633 | hotspot_y: 1 634 | 635 | image: 80 636 | x: 224 637 | y: 84 638 | width: 1 639 | height: 1 640 | hotspot_x: 0 641 | hotspot_y: 0 642 | 643 | -------------------------------------------------------------------------------- /data/font.txt: -------------------------------------------------------------------------------- 1 | num_images: 81 2 | 3 | image: 1 4 | x: 0 5 | y: 0 6 | width: 4 7 | height: 10 8 | hotspot_x: 0 9 | hotspot_y: -1 10 | 11 | image: 2 12 | x: 14 13 | y: 0 14 | width: 5 15 | height: 4 16 | hotspot_x: 0 17 | hotspot_y: -1 18 | 19 | image: 3 20 | x: 28 21 | y: 0 22 | width: 3 23 | height: 4 24 | hotspot_x: 0 25 | hotspot_y: -1 26 | 27 | image: 4 28 | x: 42 29 | y: 0 30 | width: 5 31 | height: 12 32 | hotspot_x: 0 33 | hotspot_y: 0 34 | 35 | image: 5 36 | x: 56 37 | y: 0 38 | width: 6 39 | height: 12 40 | hotspot_x: 0 41 | hotspot_y: 0 42 | 43 | image: 6 44 | x: 70 45 | y: 0 46 | width: 3 47 | height: 5 48 | hotspot_x: 0 49 | hotspot_y: -8 50 | 51 | image: 7 52 | x: 84 53 | y: 0 54 | width: 5 55 | height: 3 56 | hotspot_x: 0 57 | hotspot_y: -4 58 | 59 | image: 8 60 | x: 98 61 | y: 0 62 | width: 3 63 | height: 3 64 | hotspot_x: 0 65 | hotspot_y: -8 66 | 67 | image: 9 68 | x: 112 69 | y: 0 70 | width: 6 71 | height: 10 72 | hotspot_x: 0 73 | hotspot_y: -1 74 | 75 | image: 10 76 | x: 126 77 | y: 0 78 | width: 7 79 | height: 10 80 | hotspot_x: 0 81 | hotspot_y: -1 82 | 83 | image: 11 84 | x: 140 85 | y: 0 86 | width: 5 87 | height: 10 88 | hotspot_x: 0 89 | hotspot_y: -1 90 | 91 | image: 12 92 | x: 154 93 | y: 0 94 | width: 7 95 | height: 10 96 | hotspot_x: 0 97 | hotspot_y: -1 98 | 99 | image: 13 100 | x: 168 101 | y: 0 102 | width: 7 103 | height: 10 104 | hotspot_x: 0 105 | hotspot_y: -1 106 | 107 | image: 14 108 | x: 182 109 | y: 0 110 | width: 7 111 | height: 10 112 | hotspot_x: 0 113 | hotspot_y: -1 114 | 115 | image: 15 116 | x: 196 117 | y: 0 118 | width: 7 119 | height: 10 120 | hotspot_x: 0 121 | hotspot_y: -1 122 | 123 | image: 16 124 | x: 210 125 | y: 0 126 | width: 7 127 | height: 10 128 | hotspot_x: 0 129 | hotspot_y: -1 130 | 131 | image: 17 132 | x: 224 133 | y: 0 134 | width: 7 135 | height: 10 136 | hotspot_x: 0 137 | hotspot_y: -1 138 | 139 | image: 18 140 | x: 238 141 | y: 0 142 | width: 7 143 | height: 10 144 | hotspot_x: 0 145 | hotspot_y: -1 146 | 147 | image: 19 148 | x: 252 149 | y: 0 150 | width: 7 151 | height: 10 152 | hotspot_x: 0 153 | hotspot_y: -1 154 | 155 | image: 20 156 | x: 266 157 | y: 0 158 | width: 4 159 | height: 7 160 | hotspot_x: 0 161 | hotspot_y: -3 162 | 163 | image: 21 164 | x: 280 165 | y: 0 166 | width: 4 167 | height: 9 168 | hotspot_x: 0 169 | hotspot_y: -3 170 | 171 | image: 22 172 | x: 294 173 | y: 0 174 | width: 12 175 | height: 11 176 | hotspot_x: 0 177 | hotspot_y: 0 178 | 179 | image: 23 180 | x: 308 181 | y: 0 182 | width: 9 183 | height: 9 184 | hotspot_x: 0 185 | hotspot_y: -1 186 | 187 | image: 24 188 | x: 322 189 | y: 0 190 | width: 9 191 | height: 9 192 | hotspot_x: 0 193 | hotspot_y: -1 194 | 195 | image: 25 196 | x: 336 197 | y: 0 198 | width: 9 199 | height: 10 200 | hotspot_x: 0 201 | hotspot_y: -1 202 | 203 | image: 26 204 | x: 350 205 | y: 0 206 | width: 9 207 | height: 9 208 | hotspot_x: 0 209 | hotspot_y: -1 210 | 211 | image: 27 212 | x: 364 213 | y: 0 214 | width: 9 215 | height: 9 216 | hotspot_x: 0 217 | hotspot_y: -1 218 | 219 | image: 28 220 | x: 378 221 | y: 0 222 | width: 8 223 | height: 9 224 | hotspot_x: 0 225 | hotspot_y: -1 226 | 227 | image: 29 228 | x: 0 229 | y: 14 230 | width: 9 231 | height: 10 232 | hotspot_x: 0 233 | hotspot_y: -1 234 | 235 | image: 30 236 | x: 14 237 | y: 14 238 | width: 9 239 | height: 9 240 | hotspot_x: 0 241 | hotspot_y: -1 242 | 243 | image: 31 244 | x: 28 245 | y: 14 246 | width: 4 247 | height: 9 248 | hotspot_x: 0 249 | hotspot_y: -1 250 | 251 | image: 32 252 | x: 42 253 | y: 14 254 | width: 8 255 | height: 10 256 | hotspot_x: 0 257 | hotspot_y: -1 258 | 259 | image: 33 260 | x: 56 261 | y: 14 262 | width: 10 263 | height: 9 264 | hotspot_x: 0 265 | hotspot_y: -1 266 | 267 | image: 34 268 | x: 70 269 | y: 14 270 | width: 7 271 | height: 9 272 | hotspot_x: 0 273 | hotspot_y: -1 274 | 275 | image: 35 276 | x: 84 277 | y: 14 278 | width: 11 279 | height: 9 280 | hotspot_x: 0 281 | hotspot_y: -1 282 | 283 | image: 36 284 | x: 98 285 | y: 14 286 | width: 10 287 | height: 9 288 | hotspot_x: 0 289 | hotspot_y: -1 290 | 291 | image: 37 292 | x: 112 293 | y: 14 294 | width: 9 295 | height: 10 296 | hotspot_x: 0 297 | hotspot_y: -1 298 | 299 | image: 38 300 | x: 126 301 | y: 14 302 | width: 9 303 | height: 9 304 | hotspot_x: 0 305 | hotspot_y: -1 306 | 307 | image: 39 308 | x: 140 309 | y: 14 310 | width: 9 311 | height: 10 312 | hotspot_x: 0 313 | hotspot_y: -1 314 | 315 | image: 40 316 | x: 154 317 | y: 14 318 | width: 9 319 | height: 9 320 | hotspot_x: 0 321 | hotspot_y: -1 322 | 323 | image: 41 324 | x: 168 325 | y: 14 326 | width: 8 327 | height: 10 328 | hotspot_x: 0 329 | hotspot_y: -1 330 | 331 | image: 42 332 | x: 182 333 | y: 14 334 | width: 8 335 | height: 9 336 | hotspot_x: 0 337 | hotspot_y: -1 338 | 339 | image: 43 340 | x: 196 341 | y: 14 342 | width: 9 343 | height: 10 344 | hotspot_x: 0 345 | hotspot_y: -1 346 | 347 | image: 44 348 | x: 210 349 | y: 14 350 | width: 9 351 | height: 9 352 | hotspot_x: 0 353 | hotspot_y: -1 354 | 355 | image: 45 356 | x: 224 357 | y: 14 358 | width: 12 359 | height: 9 360 | hotspot_x: 0 361 | hotspot_y: -1 362 | 363 | image: 46 364 | x: 238 365 | y: 14 366 | width: 9 367 | height: 9 368 | hotspot_x: 0 369 | hotspot_y: -1 370 | 371 | image: 47 372 | x: 252 373 | y: 14 374 | width: 8 375 | height: 9 376 | hotspot_x: 0 377 | hotspot_y: -1 378 | 379 | image: 48 380 | x: 266 381 | y: 14 382 | width: 9 383 | height: 9 384 | hotspot_x: 0 385 | hotspot_y: -1 386 | 387 | image: 49 388 | x: 280 389 | y: 14 390 | width: 7 391 | height: 7 392 | hotspot_x: 0 393 | hotspot_y: -3 394 | 395 | image: 50 396 | x: 294 397 | y: 14 398 | width: 8 399 | height: 9 400 | hotspot_x: 0 401 | hotspot_y: -1 402 | 403 | image: 51 404 | x: 308 405 | y: 14 406 | width: 6 407 | height: 7 408 | hotspot_x: 0 409 | hotspot_y: -3 410 | 411 | image: 52 412 | x: 322 413 | y: 14 414 | width: 8 415 | height: 9 416 | hotspot_x: 0 417 | hotspot_y: -1 418 | 419 | image: 53 420 | x: 336 421 | y: 14 422 | width: 7 423 | height: 7 424 | hotspot_x: 0 425 | hotspot_y: -3 426 | 427 | image: 54 428 | x: 350 429 | y: 14 430 | width: 5 431 | height: 9 432 | hotspot_x: 0 433 | hotspot_y: -1 434 | 435 | image: 55 436 | x: 364 437 | y: 14 438 | width: 8 439 | height: 10 440 | hotspot_x: 0 441 | hotspot_y: -3 442 | 443 | image: 56 444 | x: 378 445 | y: 14 446 | width: 7 447 | height: 9 448 | hotspot_x: 0 449 | hotspot_y: -1 450 | 451 | image: 57 452 | x: 0 453 | y: 28 454 | width: 4 455 | height: 9 456 | hotspot_x: 0 457 | hotspot_y: -1 458 | 459 | image: 58 460 | x: 14 461 | y: 28 462 | width: 5 463 | height: 12 464 | hotspot_x: 0 465 | hotspot_y: -1 466 | 467 | image: 59 468 | x: 28 469 | y: 28 470 | width: 8 471 | height: 9 472 | hotspot_x: 0 473 | hotspot_y: -1 474 | 475 | image: 60 476 | x: 42 477 | y: 28 478 | width: 4 479 | height: 9 480 | hotspot_x: 0 481 | hotspot_y: -1 482 | 483 | image: 61 484 | x: 56 485 | y: 28 486 | width: 11 487 | height: 7 488 | hotspot_x: 0 489 | hotspot_y: -3 490 | 491 | image: 62 492 | x: 70 493 | y: 28 494 | width: 8 495 | height: 7 496 | hotspot_x: 0 497 | hotspot_y: -3 498 | 499 | image: 63 500 | x: 84 501 | y: 28 502 | width: 7 503 | height: 7 504 | hotspot_x: 0 505 | hotspot_y: -3 506 | 507 | image: 64 508 | x: 98 509 | y: 28 510 | width: 8 511 | height: 10 512 | hotspot_x: 0 513 | hotspot_y: -3 514 | 515 | image: 65 516 | x: 112 517 | y: 28 518 | width: 8 519 | height: 10 520 | hotspot_x: 0 521 | hotspot_y: -3 522 | 523 | image: 66 524 | x: 126 525 | y: 28 526 | width: 6 527 | height: 7 528 | hotspot_x: 0 529 | hotspot_y: -3 530 | 531 | image: 67 532 | x: 140 533 | y: 28 534 | width: 7 535 | height: 7 536 | hotspot_x: 0 537 | hotspot_y: -3 538 | 539 | image: 68 540 | x: 154 541 | y: 28 542 | width: 5 543 | height: 9 544 | hotspot_x: 0 545 | hotspot_y: -1 546 | 547 | image: 69 548 | x: 168 549 | y: 28 550 | width: 7 551 | height: 7 552 | hotspot_x: 0 553 | hotspot_y: -3 554 | 555 | image: 70 556 | x: 182 557 | y: 28 558 | width: 7 559 | height: 7 560 | hotspot_x: 0 561 | hotspot_y: -3 562 | 563 | image: 71 564 | x: 196 565 | y: 28 566 | width: 10 567 | height: 7 568 | hotspot_x: 0 569 | hotspot_y: -3 570 | 571 | image: 72 572 | x: 210 573 | y: 28 574 | width: 8 575 | height: 7 576 | hotspot_x: 0 577 | hotspot_y: -3 578 | 579 | image: 73 580 | x: 224 581 | y: 28 582 | width: 8 583 | height: 10 584 | hotspot_x: 0 585 | hotspot_y: -3 586 | 587 | image: 74 588 | x: 238 589 | y: 28 590 | width: 7 591 | height: 7 592 | hotspot_x: 0 593 | hotspot_y: -3 594 | 595 | image: 75 596 | x: 252 597 | y: 28 598 | width: 6 599 | height: 3 600 | hotspot_x: 0 601 | hotspot_y: -4 602 | 603 | image: 76 604 | x: 266 605 | y: 28 606 | width: 7 607 | height: 9 608 | hotspot_x: 0 609 | hotspot_y: -1 610 | 611 | image: 77 612 | x: 280 613 | y: 28 614 | width: 7 615 | height: 10 616 | hotspot_x: 0 617 | hotspot_y: 0 618 | 619 | image: 78 620 | x: 294 621 | y: 28 622 | width: 9 623 | height: 11 624 | hotspot_x: 0 625 | hotspot_y: 1 626 | 627 | image: 79 628 | x: 308 629 | y: 28 630 | width: 9 631 | height: 11 632 | hotspot_x: 0 633 | hotspot_y: 1 634 | 635 | image: 80 636 | x: 322 637 | y: 28 638 | width: 7 639 | height: 9 640 | hotspot_x: 0 641 | hotspot_y: -1 642 | 643 | image: 81 644 | x: 336 645 | y: 28 646 | width: 9 647 | height: 11 648 | hotspot_x: 0 649 | hotspot_y: 1 650 | 651 | -------------------------------------------------------------------------------- /globals.h: -------------------------------------------------------------------------------- 1 | /* 2 | * globals.h 3 | * Copyright (C) 1998 Brainchild Design - http://brainchilddesign.com/ 4 | * 5 | * Copyright (C) 2001 Chuck Mason 6 | * 7 | * Copyright (C) 2002 Florian Schulze 8 | * 9 | * This file is part of Jump'n'Bump. 10 | * 11 | * Jump'n'Bump is free software; you can redistribute it and/or modify 12 | * it under the terms of the GNU General Public License as published by 13 | * the Free Software Foundation; either version 2 of the License, or 14 | * (at your option) any later version. 15 | * 16 | * Jump'n'Bump is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU General Public License for more details. 20 | * 21 | * You should have received a copy of the GNU General Public License 22 | * along with this program; if not, write to the Free Software 23 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 24 | */ 25 | 26 | #ifndef __GLOBALS_H 27 | #define __GLOBALS_H 28 | 29 | #ifdef __cplusplus 30 | extern "C" { 31 | #endif 32 | 33 | #include 34 | #include 35 | #include 36 | #include 37 | #ifndef _MSC_VER 38 | #include 39 | #endif 40 | #include 41 | #include 42 | 43 | #include "dj.h" 44 | 45 | #ifdef DOS 46 | # include 47 | # include 48 | # include 49 | # include 50 | #endif 51 | 52 | #include 53 | #include 54 | #ifndef NO_SDL_MIXER 55 | #include 56 | #endif 57 | 58 | #ifndef WIN32 59 | # define stricmp SDL_strcasecmp 60 | #endif 61 | 62 | #ifndef WIN32 63 | # define strnicmp SDL_strncasecmp 64 | #endif 65 | 66 | #define JNB_MAX_PLAYERS 4 67 | 68 | #define JNB_INETPORT 11111 69 | 70 | extern int client_player_num; 71 | void tellServerPlayerMoved(int playerid, int movement_type, int newval); 72 | #define MOVEMENT_LEFT 1 73 | #define MOVEMENT_RIGHT 2 74 | #define MOVEMENT_UP 3 75 | 76 | #define JNB_WIDTH 400 77 | #define JNB_HEIGHT 256 78 | 79 | extern int screen_width; 80 | extern int screen_height; 81 | extern int screen_pitch; 82 | extern int scale_up; 83 | 84 | extern int ai[JNB_MAX_PLAYERS]; 85 | 86 | #define KEY_PL1_LEFT SDLK_LEFT 87 | #define KEY_PL1_RIGHT SDLK_RIGHT 88 | #define KEY_PL1_JUMP SDLK_UP 89 | #define KEY_PL2_LEFT SDLK_a 90 | #define KEY_PL2_RIGHT SDLK_d 91 | #define KEY_PL2_JUMP SDLK_w 92 | #define KEY_PL3_LEFT SDLK_j 93 | #define KEY_PL3_RIGHT SDLK_l 94 | #define KEY_PL3_JUMP SDLK_i 95 | #define KEY_PL4_LEFT SDLK_KP_4 96 | #define KEY_PL4_RIGHT SDLK_KP_6 97 | #define KEY_PL4_JUMP SDLK_KP_8 98 | 99 | #define NUM_POBS 200 100 | #define NUM_OBJECTS 200 101 | #define NUM_FLIES 20 102 | #define NUM_LEFTOVERS 50 103 | 104 | #define OBJ_SPRING 0 105 | #define OBJ_SPLASH 1 106 | #define OBJ_SMOKE 2 107 | #define OBJ_YEL_BUTFLY 3 108 | #define OBJ_PINK_BUTFLY 4 109 | #define OBJ_FUR 5 110 | #define OBJ_FLESH 6 111 | #define OBJ_FLESH_TRACE 7 112 | 113 | #define OBJ_ANIM_SPRING 0 114 | #define OBJ_ANIM_SPLASH 1 115 | #define OBJ_ANIM_SMOKE 2 116 | #define OBJ_ANIM_YEL_BUTFLY_RIGHT 3 117 | #define OBJ_ANIM_YEL_BUTFLY_LEFT 4 118 | #define OBJ_ANIM_PINK_BUTFLY_RIGHT 5 119 | #define OBJ_ANIM_PINK_BUTFLY_LEFT 6 120 | #define OBJ_ANIM_FLESH_TRACE 7 121 | 122 | #define MOD_MENU 0 123 | #define MOD_GAME 1 124 | #define MOD_SCORES 2 125 | 126 | #define SFX_JUMP 0 127 | #define SFX_LAND 1 128 | #define SFX_DEATH 2 129 | #define SFX_SPRING 3 130 | #define SFX_SPLASH 4 131 | #define SFX_FLY 5 132 | 133 | #define NUM_SFX 6 134 | 135 | #define SFX_JUMP_FREQ 15000 136 | #define SFX_LAND_FREQ 15000 137 | #define SFX_DEATH_FREQ 20000 138 | #define SFX_SPRING_FREQ 15000 139 | #define SFX_SPLASH_FREQ 12000 140 | #define SFX_FLY_FREQ 12000 141 | 142 | #define BAN_VOID 0 143 | #define BAN_SOLID 1 144 | #define BAN_WATER 2 145 | #define BAN_ICE 3 146 | #define BAN_SPRING 4 147 | 148 | #define UNUSED(x) (void)(x) 149 | 150 | typedef struct { 151 | int num_images; 152 | int *width; 153 | int *height; 154 | int *hs_x; 155 | int *hs_y; 156 | void **data; 157 | void **orig_data; 158 | } gob_t; 159 | 160 | typedef struct { 161 | int joy_enabled, mouse_enabled; 162 | int no_sound, music_no_sound, no_gore, fireworks; 163 | char error_str[256]; 164 | int draw_page, view_page; 165 | struct { 166 | int num_pobs; 167 | struct { 168 | int x, y; 169 | int image; 170 | gob_t *pob_data; 171 | int back_buf_ofs; 172 | } pobs[NUM_POBS]; 173 | } page_info[2]; 174 | void *pob_backbuf[2]; 175 | } main_info_t; 176 | 177 | typedef struct { 178 | int action_left,action_up,action_right; 179 | int enabled, dead_flag; 180 | int bumps; 181 | int bumped[JNB_MAX_PLAYERS]; 182 | int x, y; 183 | int x_add, y_add; 184 | int direction, jump_ready, jump_abort, in_water; 185 | int anim, frame, frame_tick, image; 186 | } player_t; 187 | 188 | typedef struct { 189 | int num_frames; 190 | int restart_frame; 191 | struct { 192 | int image; 193 | int ticks; 194 | } frame[4]; 195 | } player_anim_t; 196 | 197 | typedef struct { 198 | int used, type; 199 | int x, y; 200 | int x_add, y_add; 201 | int x_acc, y_acc; 202 | int anim; 203 | int frame, ticks; 204 | int image; 205 | } object_t; 206 | 207 | typedef struct { 208 | int x, y; 209 | int raw_x, raw_y; 210 | int but1, but2; 211 | } joy_t; 212 | 213 | typedef struct { 214 | int but1, but2, but3; 215 | } mouse_t; 216 | 217 | extern main_info_t main_info; 218 | extern player_t player[JNB_MAX_PLAYERS]; 219 | extern player_anim_t player_anims[7]; 220 | extern object_t objects[NUM_OBJECTS]; 221 | extern joy_t joy; 222 | extern mouse_t mouse; 223 | 224 | extern char *background_pic; 225 | extern char *mask_pic; 226 | 227 | extern gob_t rabbit_gobs; 228 | extern gob_t font_gobs; 229 | extern gob_t object_gobs; 230 | extern gob_t number_gobs; 231 | 232 | 233 | /* fireworks.c */ 234 | 235 | void fireworks(void); 236 | 237 | 238 | /* main.c */ 239 | 240 | unsigned char *dat_open(char *file_name); 241 | void steer_players(void); 242 | void position_player(int player_num); 243 | void fireworks(void); 244 | void add_object(int type, int x, int y, int x_add, int y_add, int anim, int frame); 245 | void update_objects(void); 246 | int add_pob(int page, int x, int y, int image, gob_t *pob_data); 247 | void draw_flies(); 248 | void draw_pobs(int page); 249 | void redraw_flies_background(int page); 250 | void redraw_pob_backgrounds(int page); 251 | int add_leftovers(int page, int x, int y, int image, gob_t *pob_data); 252 | void draw_leftovers(int page); 253 | int init_level(char *pal); 254 | void deinit_level(void); 255 | int init_program(int argc, char *argv[], char *pal); 256 | void deinit_program(void); 257 | unsigned short rnd(unsigned short max); 258 | int read_level(void); 259 | unsigned char *dat_open(char *file_name); 260 | int dat_filelen(char *file_name); 261 | 262 | 263 | /* input.c */ 264 | 265 | void update_player_actions(void); 266 | void init_inputs(void); 267 | 268 | /* menu.c */ 269 | 270 | int menu(void); 271 | int menu_init(void); 272 | 273 | 274 | /* gfx.c */ 275 | 276 | void exit_fullscreen(); 277 | void fs_toggle(); 278 | void set_scaling(int scale); 279 | void open_screen(void); 280 | void reinit_screen(void); 281 | void wait_vrt(); 282 | void draw_begin(void); 283 | void draw_end(void); 284 | void flippage(int page); 285 | void draw_begin(void); 286 | void draw_end(void); 287 | void clear_lines(int page, int y, int count, int color); 288 | int get_color(int color, char pal[768]); 289 | int get_pixel(int page, int x, int y); 290 | void set_pixel(int page, int x, int y, int color); 291 | void setpalette(int index, int count, char *palette); 292 | void fillpalette(int red, int green, int blue); 293 | #ifdef DOS 294 | void get_block(char page, short x, short y, short width, short height, char *buffer); 295 | void put_block(char page, short x, short y, short width, short height, char *buffer); 296 | #else 297 | void get_block(int page, int x, int y, int width, int height, void *buffer); 298 | void put_block(int page, int x, int y, int width, int height, void *buffer); 299 | #endif 300 | void put_text(int page, int x, int y, char *text, int align); 301 | void put_pob(int page, int x, int y, int image, gob_t *gob, int mask); 302 | int pob_width(int image, gob_t *gob); 303 | int pob_height(int image, gob_t *gob); 304 | int pob_hs_x(int image, gob_t *gob); 305 | int pob_hs_y(int image, gob_t *gob); 306 | int read_pcx(unsigned char * handle, void *buffer, int buf_len, char *pal); 307 | void register_background(char *pixels, char pal[768]); 308 | int register_gob(unsigned char *handle, gob_t *gob, int len); 309 | void register_mask(void *pixels); 310 | void on_resized(int width, int height); 311 | 312 | /* gfx.c */ 313 | 314 | #ifdef USE_SDL 315 | /* long filelength(int handle); */ 316 | void fs_toggle(); 317 | void exit_fullscreen(); 318 | int intr_sysupdate(); 319 | #endif 320 | 321 | /* interrpt.c */ 322 | 323 | extern char last_keys[50]; 324 | 325 | int intr_sysupdate(); 326 | int hook_keyb_handler(void); 327 | void remove_keyb_handler(void); 328 | int key_pressed(int key); 329 | int addkey(unsigned int key); 330 | 331 | /* sound-linux.c */ 332 | #ifdef LINUX 333 | 334 | 335 | #endif 336 | 337 | #ifdef __cplusplus 338 | } 339 | #endif 340 | 341 | #endif 342 | -------------------------------------------------------------------------------- /modify/gobpack.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | typedef struct { 7 | int num_images; 8 | int *width; 9 | int *height; 10 | int *hs_x; 11 | int *hs_y; 12 | void **data; 13 | void **orig_data; 14 | } gob_t; 15 | 16 | static void read_pcx(FILE * handle, void *buf, int buf_len, char *pal) 17 | { 18 | unsigned char *buffer=buf; 19 | short c1; 20 | short a, b; 21 | long ofs1; 22 | if (buffer != 0) { 23 | fseek(handle, 128, SEEK_CUR); 24 | ofs1 = 0; 25 | while (ofs1 < buf_len) { 26 | a = fgetc(handle); 27 | if ((a & 0xc0) == 0xc0) { 28 | b = fgetc(handle); 29 | a &= 0x3f; 30 | for (c1 = 0; c1 < a && ofs1 < buf_len; c1++) 31 | buffer[ofs1++] = (char) b; 32 | } else 33 | buffer[ofs1++] = (char) a; 34 | } 35 | if (pal != 0) { 36 | fseek(handle, 1, SEEK_CUR); 37 | for (c1 = 0; c1 < 768; c1++) 38 | pal[c1] = fgetc(handle) >> 2; 39 | } 40 | } 41 | } 42 | 43 | static void write_pcx(FILE *pcxfile, unsigned char *data, int width, int height, unsigned char *palette) 44 | { 45 | int i; 46 | 47 | fputc(0x0a, pcxfile); /* manufacturer */ 48 | fputc(5, pcxfile); /* version */ 49 | fputc(1, pcxfile); /* encoding */ 50 | fputc(8, pcxfile); /* bits_per_pixel */ 51 | fputc(0, pcxfile); /* xmin */ 52 | fputc(0, pcxfile); 53 | fputc(0, pcxfile); /* ymin */ 54 | fputc(0, pcxfile); 55 | fputc((width - 1) & 0xff, pcxfile); /* xmax */ 56 | fputc(((width - 1) >> 8) & 0xff, pcxfile); 57 | fputc((height - 1) & 0xff, pcxfile); /* ymax */ 58 | fputc(((height - 1) >> 8) & 0xff, pcxfile); 59 | fputc(width & 0xff, pcxfile); /* hres */ 60 | fputc((width >> 8) & 0xff, pcxfile); 61 | fputc(height & 0xff, pcxfile); /* vres */ 62 | fputc((height >> 8) & 0xff, pcxfile); 63 | for (i = 0; i < 48; i++) /* palette */ 64 | fputc(0, pcxfile); 65 | fputc(0, pcxfile); /* reserved */ 66 | fputc(1, pcxfile); /* color_planes */ 67 | fputc(width & 0xff, pcxfile); /* bytes_per_line */ 68 | fputc((width >> 8) & 0xff, pcxfile); 69 | fputc(1 & 0xff, pcxfile); /* palette_type */ 70 | fputc((1 >> 8) & 0xff, pcxfile); 71 | for (i = 0; i < 58; i++) /* filler */ 72 | fputc(0, pcxfile); 73 | 74 | /* pack the image */ 75 | 76 | for (i = 0 ; i < width*height ; i++) 77 | if ( (*data & 0xc0) != 0xc0) 78 | fputc(*data++, pcxfile); 79 | else 80 | { 81 | fputc(0xc1, pcxfile); 82 | fputc(*data++, pcxfile); 83 | } 84 | 85 | /* write the palette */ 86 | 87 | fputc(0x0c, pcxfile); /* palette ID byte */ 88 | if (palette) 89 | for (i = 0 ; i < 768 ; i++) 90 | fputc(*palette++, pcxfile); 91 | else 92 | for (i = 0 ; i < 768 ; i++) 93 | fputc(i / 3, pcxfile); 94 | } 95 | 96 | int read_gob(FILE *handle, gob_t *gob, int len) 97 | { 98 | unsigned char *gob_data; 99 | int i; 100 | 101 | gob_data = malloc(len); 102 | fread(gob_data, 1, len, handle); 103 | 104 | gob->num_images = (short)((gob_data[0]) + (gob_data[1] << 8)); 105 | 106 | gob->width = malloc(gob->num_images*sizeof(int)); 107 | gob->height = malloc(gob->num_images*sizeof(int)); 108 | gob->hs_x = malloc(gob->num_images*sizeof(int)); 109 | gob->hs_y = malloc(gob->num_images*sizeof(int)); 110 | gob->data = malloc(gob->num_images*sizeof(void *)); 111 | gob->orig_data = malloc(gob->num_images*sizeof(void *)); 112 | for (i=0; inum_images; i++) { 113 | int image_size; 114 | int offset; 115 | 116 | offset = (gob_data[i*4+2]) + (gob_data[i*4+3] << 8) + (gob_data[i*4+4] << 16) + (gob_data[i*4+5] << 24); 117 | 118 | gob->width[i] = (short)((gob_data[offset]) + (gob_data[offset+1] << 8)); offset += 2; 119 | gob->height[i] = (short)((gob_data[offset]) + (gob_data[offset+1] << 8)); offset += 2; 120 | gob->hs_x[i] = (short)((gob_data[offset]) + (gob_data[offset+1] << 8)); offset += 2; 121 | gob->hs_y[i] = (short)((gob_data[offset]) + (gob_data[offset+1] << 8)); offset += 2; 122 | 123 | image_size = gob->width[i] * gob->height[i]; 124 | gob->orig_data[i] = malloc(image_size); 125 | memcpy(gob->orig_data[i], &gob_data[offset], image_size); 126 | gob->data[i] = (unsigned short *)gob->orig_data[i]; 127 | } 128 | free(gob_data); 129 | return 0; 130 | } 131 | 132 | int write_gob(FILE *handle, gob_t *gob) 133 | { 134 | int i; 135 | int offset; 136 | 137 | fputc((gob->num_images >> 0) & 0xff, handle); 138 | fputc((gob->num_images >> 8) & 0xff, handle); 139 | 140 | offset = 2 + (gob->num_images * 4); 141 | 142 | for (i=0; inum_images; i++) { 143 | fputc((offset >> 0) & 0xff, handle); 144 | fputc((offset >> 8) & 0xff, handle); 145 | fputc((offset >> 16) & 0xff, handle); 146 | fputc((offset >> 24) & 0xff, handle); 147 | 148 | offset += 8; 149 | offset += gob->width[i] * gob->height[i]; 150 | } 151 | for (i=0; inum_images; i++) { 152 | fputc((gob->width[i] >> 0) & 0xff, handle); 153 | fputc((gob->width[i] >> 8) & 0xff, handle); 154 | 155 | fputc((gob->height[i] >> 0) & 0xff, handle); 156 | fputc((gob->height[i] >> 8) & 0xff, handle); 157 | 158 | fputc((gob->hs_x[i] >> 0) & 0xff, handle); 159 | fputc((gob->hs_x[i] >> 8) & 0xff, handle); 160 | 161 | fputc((gob->hs_y[i] >> 0) & 0xff, handle); 162 | fputc((gob->hs_y[i] >> 8) & 0xff, handle); 163 | 164 | fwrite(gob->data[i], 1, gob->width[i] * gob->height[i], handle); 165 | } 166 | return 0; 167 | } 168 | 169 | int main(int argc, char **argv) 170 | { 171 | int usage = 0; 172 | int unpack = 0; 173 | FILE *f; 174 | int len; 175 | gob_t gob; 176 | char *filename = NULL; 177 | 178 | if (argc < 2) 179 | usage = 1; 180 | 181 | if (argc > 1) 182 | if (argv[1][0] == '-') { 183 | if (argv[1][1] == 'u') { 184 | if (argc < 3) 185 | usage = 1; 186 | unpack = 1; 187 | } else 188 | usage = 1; 189 | } 190 | 191 | if (usage) { 192 | printf("Usage: gobpack [-u] [palette.pcx]\n\t-u to unpack the gob\n"); 193 | return 1; 194 | } 195 | 196 | if (unpack) { 197 | int width, height; 198 | int x_count, y_count; 199 | int xi, yi; 200 | int i; 201 | unsigned char *data; 202 | unsigned char *dst; 203 | unsigned char palette[768]; 204 | unsigned char *pal = NULL; 205 | 206 | if (argc > 3) { 207 | f = fopen(argv[3], "rb"); 208 | if (f) { 209 | fseek(f, -769, SEEK_END); 210 | i = fgetc(f); 211 | if (i == 0x0c) { 212 | pal = palette; 213 | fread(pal, 1, 768, f); 214 | } 215 | fclose(f); 216 | } 217 | } 218 | 219 | filename = malloc(strlen(argv[2]) + 5); 220 | if (!filename) { 221 | printf("Not enough memory!\n"); 222 | return -1; 223 | } 224 | 225 | strcpy(filename, argv[2]); 226 | strcat(filename, ".gob"); 227 | f = fopen(filename, "rb"); 228 | if (!f) { 229 | printf("Couldn't open file %s\n", filename); 230 | return -1; 231 | } 232 | fseek(f, 0, SEEK_END); 233 | len = ftell(f); 234 | fseek(f, 0, SEEK_SET); 235 | 236 | read_gob(f, &gob, len); 237 | 238 | fclose(f); 239 | 240 | width = 0; 241 | height = 0; 242 | for (i = 0; i < gob.num_images; i++) { 243 | if (gob.height[i] > height) 244 | height = gob.height[i]; 245 | if (gob.width[i] > width) 246 | width = gob.width[i]; 247 | } 248 | width+=2; 249 | height+=2; 250 | 251 | data = malloc(400*256); 252 | if (!data) { 253 | printf("Not enough memory!\n"); 254 | return -1; 255 | } 256 | memset(data, 0, 400*256); 257 | 258 | x_count = 400 / width; 259 | y_count = 256 / width; 260 | 261 | for (yi = 0; yi < y_count; yi++) { 262 | for (xi = 0; xi < x_count; xi++) { 263 | int x,y; 264 | unsigned char *src; 265 | 266 | i = yi * x_count + xi; 267 | if (i >= gob.num_images) 268 | continue; 269 | 270 | src = gob.data[i]; 271 | dst = &data[(yi * height) * 400 + (xi * width)]; 272 | for (y = 0; y < gob.height[i]; y++) { 273 | for (x = 0; x < gob.width[i]; x++) { 274 | dst[y * 400 + x] = src[y * gob.width[i] + x]; 275 | } 276 | } 277 | } 278 | } 279 | 280 | strcpy(filename, argv[2]); 281 | strcat(filename, ".pcx"); 282 | f = fopen(filename, "wb"); 283 | if (!f) { 284 | printf("Couldn't open file %s\n", filename); 285 | return -1; 286 | } 287 | 288 | write_pcx(f, data, 400, 256, pal); 289 | 290 | fclose(f); 291 | 292 | strcpy(filename, argv[2]); 293 | strcat(filename, ".txt"); 294 | f = fopen(filename, "w"); 295 | if (!f) { 296 | printf("Couldn't open file %s\n", filename); 297 | return -1; 298 | } 299 | 300 | fprintf(f, "num_images: %i\n\n", gob.num_images); 301 | for (yi = 0; yi < y_count; yi++) { 302 | for (xi = 0; xi < x_count; xi++) { 303 | 304 | i = yi * x_count + xi; 305 | if (i >= gob.num_images) 306 | continue; 307 | 308 | fprintf(f, "image: %i\n", i + 1); 309 | fprintf(f, "x: %i\n", (xi * width)); 310 | fprintf(f, "y: %i\n", (yi * height)); 311 | fprintf(f, "width: %i\n", gob.width[i]); 312 | fprintf(f, "height: %i\n", gob.height[i]); 313 | fprintf(f, "hotspot_x: %i\n", gob.hs_x[i]); 314 | fprintf(f, "hotspot_y: %i\n", gob.hs_y[i]); 315 | fprintf(f, "\n"); 316 | } 317 | } 318 | 319 | fclose(f); 320 | } else { 321 | unsigned char *data; 322 | int i = 0; 323 | int x_pos = 0, y_pos = 0; 324 | 325 | data = malloc(400*256); 326 | if (!data) { 327 | printf("Not enough memory!\n"); 328 | return -1; 329 | } 330 | 331 | filename = malloc(strlen(argv[1]) + 5); 332 | if (!filename) { 333 | printf("Not enough memory!\n"); 334 | return -1; 335 | } 336 | 337 | strcpy(filename, argv[1]); 338 | strcat(filename, ".pcx"); 339 | f = fopen(filename, "rb"); 340 | if (!f) { 341 | printf("Couldn't open file %s\n", filename); 342 | return -1; 343 | } 344 | 345 | read_pcx(f, data, 400*256, NULL); 346 | 347 | fclose(f); 348 | 349 | strcpy(filename, argv[1]); 350 | strcat(filename, ".txt"); 351 | f = fopen(filename, "r"); 352 | if (!f) { 353 | printf("Couldn't open file %s\n", filename); 354 | return -1; 355 | } 356 | 357 | gob.num_images = 0; 358 | 359 | while (!feof(f)) { 360 | char buffer[1024]; 361 | int value; 362 | 363 | fscanf(f, "%s %i\n", buffer, &value); 364 | if (strcmp(buffer, "num_images:") == 0) { 365 | if (gob.num_images != 0) { 366 | printf("Parse error in %s\n", filename); 367 | return -1; 368 | } 369 | gob.num_images = value; 370 | gob.width = malloc(gob.num_images*sizeof(int)); 371 | gob.height = malloc(gob.num_images*sizeof(int)); 372 | gob.hs_x = malloc(gob.num_images*sizeof(int)); 373 | gob.hs_y = malloc(gob.num_images*sizeof(int)); 374 | gob.data = malloc(gob.num_images*sizeof(void *)); 375 | gob.orig_data = malloc(gob.num_images*sizeof(void *)); 376 | } else if (strcmp(buffer, "image:") == 0) { 377 | i = value - 1; 378 | } else if (strcmp(buffer, "x:") == 0) { 379 | x_pos = value; 380 | } else if (strcmp(buffer, "y:") == 0) { 381 | y_pos = value; 382 | } else if (strcmp(buffer, "width:") == 0) { 383 | gob.width[i] = value; 384 | } else if (strcmp(buffer, "height:") == 0) { 385 | gob.height[i] = value; 386 | } else if (strcmp(buffer, "hotspot_x:") == 0) { 387 | gob.hs_x[i] = value; 388 | } else if (strcmp(buffer, "hotspot_y:") == 0) { 389 | int x, y; 390 | unsigned char *dst; 391 | 392 | gob.hs_y[i] = value; 393 | gob.orig_data[i] = malloc(gob.width[i] * gob.height[i]); 394 | gob.data[i] = gob.orig_data[i]; 395 | dst = gob.data[i]; 396 | for (y = 0; y < gob.height[i]; y++) { 397 | for (x = 0; x < gob.width[i]; x++) { 398 | dst[y * gob.width[i] + x] = data[(y_pos + y) * 400 + (x_pos + x)]; 399 | } 400 | } 401 | } 402 | } 403 | 404 | fclose(f); 405 | 406 | strcpy(filename, argv[1]); 407 | strcat(filename, ".gob"); 408 | filename = basename(filename); 409 | f = fopen(filename, "wb"); 410 | if (!f) { 411 | printf("Couldn't open file %s\n", filename); 412 | return -1; 413 | } 414 | 415 | write_gob(f, &gob); 416 | 417 | fclose(f); 418 | 419 | printf("%s build\n", filename); 420 | } 421 | 422 | return 0; 423 | } 424 | -------------------------------------------------------------------------------- /sdl/interrpt.c: -------------------------------------------------------------------------------- 1 | /* 2 | * interrpt.c 3 | * Copyright (C) 1998 Brainchild Design - http://brainchilddesign.com/ 4 | * 5 | * Copyright (C) 2001 Chuck Mason 6 | * 7 | * Copyright (C) 2002 Florian Schulze 8 | * 9 | * This file is part of Jump'n'Bump. 10 | * 11 | * Jump'n'Bump is free software; you can redistribute it and/or modify 12 | * it under the terms of the GNU General Public License as published by 13 | * the Free Software Foundation; either version 2 of the License, or 14 | * (at your option) any later version. 15 | * 16 | * Jump'n'Bump is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU General Public License for more details. 20 | * 21 | * You should have received a copy of the GNU General Public License 22 | * along with this program; if not, write to the Free Software 23 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 24 | */ 25 | 26 | #include 27 | #include 28 | #include 29 | 30 | #if defined(__SWITCH__) || defined(__PSP2__) 31 | #include "globals.h" 32 | #include 33 | extern int num_joys; 34 | extern SDL_Joystick* joys[4]; 35 | #endif 36 | 37 | #ifndef _MSC_VER 38 | #include 39 | #endif 40 | #include "globals.h" 41 | 42 | #ifdef USE_KAILLERA 43 | #include 44 | #include 45 | #include 46 | 47 | char local_keyb[256]; 48 | #endif /* USE_KAILLERA */ 49 | 50 | char keyb[256]; 51 | char last_keys[50]; 52 | 53 | extern SDL_Joystick* accelerometer; 54 | 55 | #ifdef USE_KAILLERA 56 | 57 | /* information about the party in this session */ 58 | static int my_player = -1; 59 | static int my_numplayers = -1; 60 | 61 | /* semaphore for controlling kaillera thread */ 62 | static SDL_sem *game_start_sem = NULL; 63 | 64 | /* keys supported on my end */ 65 | static int my_player_up = -1; 66 | static int my_player_left = -1; 67 | static int my_player_right = 1; 68 | 69 | /* values for the kaillera client interface */ 70 | static char kaillera_app_name[] = "Jump 'n Bump"; 71 | static char kaillera_game_name[] = "Jump 'n Bump\0\0"; 72 | 73 | static int player_keys[4][3] = { 74 | { 75 | KEY_PL1_LEFT, 76 | KEY_PL1_RIGHT, 77 | KEY_PL1_JUMP 78 | }, 79 | { 80 | KEY_PL2_LEFT, 81 | KEY_PL2_RIGHT, 82 | KEY_PL2_JUMP 83 | }, 84 | { 85 | KEY_PL3_LEFT, 86 | KEY_PL3_RIGHT, 87 | KEY_PL3_JUMP 88 | }, 89 | { 90 | KEY_PL4_LEFT, 91 | KEY_PL4_RIGHT, 92 | KEY_PL4_JUMP 93 | } 94 | }; 95 | 96 | static int WINAPI kaillera_game_callback(char *game, int player, int numplayers) 97 | { 98 | int length; 99 | int urand; 100 | unsigned char random[8]; 101 | 102 | if (strcmp(game, kaillera_game_name) != 0) { 103 | printf("unknown game selected: %s\n", game); 104 | 105 | my_player = -1; 106 | goto release; 107 | } 108 | 109 | printf("start network game with %d players\n", numplayers); 110 | printf("I am player %d\n", player); 111 | 112 | my_player = player; 113 | my_numplayers = numplayers; 114 | 115 | my_player_up = player_keys[player-1][0] & 0xff; 116 | my_player_left = player_keys[player-1][1] & 0xff; 117 | my_player_right = player_keys[player-1][2] & 0xff; 118 | 119 | /* initialize randomizer agreed by all players */ 120 | random[0] = time(0) & 0xff; 121 | random[1] = random[2] = random[3] = 0x00; 122 | length = kailleraModifyPlayValues(&random, sizeof(random[0])); 123 | if (length < 0) { 124 | goto release; 125 | } 126 | 127 | urand = random[3] << 24 | random[2] << 16 | random[1] << 8 | random[0]; 128 | srand(urand); 129 | 130 | release: 131 | 132 | SDL_SemPost(game_start_sem); 133 | return 0; 134 | } 135 | 136 | static kailleraInfos kaillera_data = { 137 | kaillera_app_name, 138 | kaillera_game_name, 139 | kaillera_game_callback, 140 | NULL, 141 | NULL, 142 | NULL 143 | }; 144 | 145 | static void print_version() 146 | { 147 | char version[16]; 148 | 149 | kailleraGetVersion(version); 150 | printf("using kaillera version %s\n", version); 151 | } 152 | 153 | static int kaillera_thread(void *arg) 154 | { 155 | kailleraInit(); 156 | 157 | /* print_version(); */ 158 | 159 | kailleraSetInfos(&kaillera_data); 160 | 161 | kailleraSelectServerDialog(0); 162 | if (SDL_SemValue(game_start_sem) == 0) { 163 | /* server dialog returned and game didnt start */ 164 | 165 | /* release blocking thread */ 166 | my_player = -1; 167 | SDL_SemPost(game_start_sem); 168 | } 169 | 170 | return 0; 171 | } 172 | 173 | static int start_kaillera_thread(void) 174 | { 175 | SDL_Thread *thread; 176 | 177 | game_start_sem = SDL_CreateSemaphore(0); 178 | 179 | thread = SDL_CreateThread(kaillera_thread, NULL); 180 | if (!thread) { 181 | printf("SDL_CreateThread failed\n"); 182 | return -1; 183 | } 184 | 185 | return 0; 186 | } 187 | 188 | int addkey(unsigned int key) 189 | { 190 | /* it doesnt matter if a player presses keys 191 | * that control other bunnies. whatever is sent 192 | * is packed by pack_keys() 193 | */ 194 | if (!(key & 0x8000)) { 195 | local_keyb[key & 0x7fff] = 1; 196 | } else 197 | local_keyb[key & 0x7fff] = 0; 198 | return 0; 199 | } 200 | 201 | void remove_keyb_handler(void) 202 | { 203 | kailleraShutdown(); 204 | } 205 | 206 | int pack_keys(void) 207 | { 208 | int rv; 209 | 210 | rv = local_keyb[my_player_up]; 211 | rv |= local_keyb[my_player_left] << 1; 212 | rv |= local_keyb[my_player_right] << 2; 213 | rv |= local_keyb[1] << 3; 214 | return rv; 215 | } 216 | 217 | void unpack_keys(int player, char value) 218 | { 219 | keyb[player_keys[player][0] & 0xff] = (value >> 0) & 1; 220 | keyb[player_keys[player][1] & 0xff] = (value >> 1) & 1; 221 | keyb[player_keys[player][2] & 0xff] = (value >> 2) & 1; 222 | 223 | /* escape key is shared among all users */ 224 | keyb[1] |= (value >> 3) & 1; 225 | } 226 | 227 | int update_kaillera_keys(void) 228 | { 229 | char keys[8]; 230 | int length; 231 | int player; 232 | 233 | keys[0] = pack_keys(); 234 | length = kailleraModifyPlayValues(&keys, sizeof(keys[0])); 235 | 236 | if (length < 0) { 237 | /* terminate session */ 238 | printf("** LOST CONNECTION **\n"); 239 | kailleraEndGame(); 240 | my_player = -1; 241 | return -1; 242 | } 243 | 244 | for (player=0; player 0; c1--) 285 | last_keys[c1] = last_keys[c1 - 1]; 286 | last_keys[0] = key & 0x7fff; 287 | } else 288 | keyb[key & 0x7fff] = 0; 289 | return 0; 290 | } 291 | 292 | void remove_keyb_handler(void) 293 | { 294 | } 295 | 296 | int hook_keyb_handler(void) 297 | { 298 | memset((void *) last_keys, 0, sizeof(last_keys)); 299 | 300 | return 0; 301 | } 302 | 303 | int key_pressed(int key) 304 | { 305 | #if defined(__SWITCH__) || defined(__PSP2__) 306 | if (key == 1) { 307 | for (int i = 0; i < num_joys; i++) { 308 | if (i < 4) { 309 | // any player plus or minus (start or select) acts as escape key on switch (vita) 310 | if (SDL_JoystickGetButton(joys[i], 10) || SDL_JoystickGetButton(joys[i], 11)) { 311 | return 1; 312 | } 313 | } 314 | } 315 | } 316 | #endif 317 | return keyb[(unsigned char) key]; 318 | } 319 | 320 | 321 | #endif /* USE_KAILLERA */ 322 | 323 | int intr_sysupdate() 324 | { 325 | SDL_Event e; 326 | int i = 0; 327 | static int last_time = 0; 328 | int now, time_diff; 329 | 330 | while (SDL_PollEvent(&e)) { 331 | switch (e.type) { 332 | case SDL_MOUSEBUTTONDOWN: 333 | case SDL_MOUSEBUTTONUP: 334 | if (accelerometer) { 335 | if (e.button.button == SDL_BUTTON_LEFT) { 336 | if (e.button.state == SDL_PRESSED) { 337 | addkey(KEY_PL1_JUMP & 0x7f); 338 | } else { 339 | addkey((KEY_PL1_JUMP & 0x7f) | 0x8000); 340 | } 341 | } 342 | } else { 343 | if (e.button.state == SDL_PRESSED && 344 | ((key_pressed(KEY_PL3_LEFT) && e.button.button == SDL_BUTTON_RIGHT) || 345 | (key_pressed(KEY_PL3_RIGHT) && e.button.button == SDL_BUTTON_LEFT) || 346 | (e.button.button == SDL_BUTTON_LEFT && e.button.button == SDL_BUTTON_RIGHT) || 347 | e.button.button == SDL_BUTTON_MIDDLE)) 348 | { 349 | addkey(KEY_PL3_JUMP & 0x7f); 350 | } 351 | else if (e.button.state == SDL_RELEASED && 352 | ((key_pressed(KEY_PL3_LEFT) && e.button.button == SDL_BUTTON_RIGHT) || 353 | (key_pressed(KEY_PL3_RIGHT) && e.button.button == SDL_BUTTON_LEFT) || 354 | e.button.button == SDL_BUTTON_MIDDLE)) 355 | { 356 | addkey((KEY_PL3_JUMP & 0x7f) | 0x8000); 357 | } 358 | 359 | if (e.button.button == SDL_BUTTON_LEFT) { 360 | SDL_Keycode sym = KEY_PL3_LEFT; 361 | sym &= 0x7f; 362 | if(e.button.state == SDL_RELEASED) { 363 | if(key_pressed(KEY_PL3_JUMP) && (SDL_GetMouseState(NULL, NULL)&SDL_BUTTON(SDL_BUTTON_RIGHT))) 364 | addkey(KEY_PL3_RIGHT & 0x7f); 365 | else 366 | sym |= 0x8000; 367 | } 368 | addkey(sym); 369 | } 370 | else if (e.button.button == SDL_BUTTON_RIGHT) { 371 | SDL_Keycode sym = KEY_PL3_RIGHT; 372 | sym &= 0x7f; 373 | if (e.button.state == SDL_RELEASED) { 374 | if(key_pressed(KEY_PL3_JUMP) && (SDL_GetMouseState(NULL, NULL)&SDL_BUTTON(SDL_BUTTON_LEFT))) 375 | addkey(KEY_PL3_LEFT & 0x7f); 376 | else 377 | sym |= 0x8000; 378 | } 379 | addkey(sym); 380 | } 381 | } 382 | break; 383 | case SDL_KEYDOWN: 384 | case SDL_KEYUP: 385 | switch (e.key.keysym.sym) { 386 | case SDLK_F12: 387 | if (e.type == SDL_KEYDOWN) { 388 | SDL_Quit(); 389 | exit(1); 390 | } 391 | break; 392 | case SDLK_F10: 393 | if (e.type == SDL_KEYDOWN) { 394 | fs_toggle(); 395 | } 396 | break; 397 | case SDLK_1: 398 | if (e.type == SDL_KEYUP) 399 | ai[0] = !ai[0]; 400 | 401 | /* Release keys, otherwise it will continue moving that way */ 402 | addkey((KEY_PL1_LEFT & 0x7f) | 0x8000); 403 | addkey((KEY_PL1_RIGHT & 0x7f) | 0x8000); 404 | addkey((KEY_PL1_JUMP & 0x7f) | 0x8000); 405 | break; 406 | case SDLK_2: 407 | if (e.type == SDL_KEYUP) 408 | ai[1] = !ai[1]; 409 | 410 | /* Release keys, otherwise it will continue moving that way */ 411 | addkey((KEY_PL2_LEFT & 0x7f) | 0x8000); 412 | addkey((KEY_PL2_RIGHT & 0x7f) | 0x8000); 413 | addkey((KEY_PL2_JUMP & 0x7f) | 0x8000); 414 | break; 415 | case SDLK_3: 416 | if (e.type == SDL_KEYUP) 417 | ai[2] = !ai[2]; 418 | 419 | /* Release keys, otherwise it will continue moving that way */ 420 | addkey((KEY_PL3_LEFT & 0x7f) | 0x8000); 421 | addkey((KEY_PL3_RIGHT & 0x7f) | 0x8000); 422 | addkey((KEY_PL3_JUMP & 0x7f) | 0x8000); 423 | break; 424 | case SDLK_4: 425 | if (e.type == SDL_KEYUP) 426 | ai[3] = !ai[3]; 427 | 428 | /* Release keys, otherwise it will continue moving that way */ 429 | addkey((KEY_PL4_LEFT & 0x7f) | 0x8000); 430 | addkey((KEY_PL4_RIGHT & 0x7f) | 0x8000); 431 | addkey((KEY_PL4_JUMP & 0x7f) | 0x8000); 432 | break; 433 | case SDLK_ESCAPE: 434 | case SDLK_AC_BACK: 435 | case SDLK_BACKSPACE: 436 | if (e.type == SDL_KEYUP) 437 | addkey(1 | 0x8000); 438 | else 439 | addkey(1 & 0x7f); 440 | break; 441 | default: 442 | e.key.keysym.sym &= 0x7f; 443 | if (e.type == SDL_KEYUP) 444 | e.key.keysym.sym |= 0x8000; 445 | addkey(e.key.keysym.sym); 446 | 447 | break; 448 | } 449 | break; 450 | case SDL_WINDOWEVENT: 451 | switch (e.window.event) { 452 | case SDL_WINDOWEVENT_RESTORED: 453 | reinit_screen(); 454 | break; 455 | case SDL_WINDOWEVENT_RESIZED: 456 | on_resized(e.window.data1, e.window.data2); 457 | break; 458 | case SDL_WINDOWEVENT_SHOWN: 459 | case SDL_WINDOWEVENT_MAXIMIZED: 460 | { 461 | int w = 0, h = 0; 462 | SDL_Window* window = SDL_GetWindowFromID(e.window.windowID); 463 | if (window) 464 | SDL_GetWindowSize(window, &w, &h); 465 | if ((w > 0) && (h > 0)) 466 | on_resized(w, h); 467 | } 468 | break; 469 | } 470 | break; 471 | case SDL_QUIT: 472 | deinit_program(); 473 | break; 474 | default: 475 | break; 476 | } 477 | i++; 478 | } 479 | 480 | SDL_Delay(1); 481 | now = SDL_GetTicks(); 482 | time_diff = now - last_time; 483 | if (time_diff>0) { 484 | i = time_diff / (1000 / 60); 485 | if (i) { 486 | last_time = now; 487 | } else { 488 | int tmp; 489 | 490 | tmp = (1000/60) - i - 10; 491 | if (tmp>0) 492 | SDL_Delay(tmp); 493 | } 494 | } 495 | /* 496 | if (!then) 497 | SDL_Delay(1); 498 | else { 499 | then = (1000 / 60) - (now - then); 500 | if (then > 0 && then < 1000) 501 | SDL_Delay(then); 502 | } 503 | then = now; 504 | */ 505 | 506 | #ifdef USE_KAILLERA 507 | if (my_player >= 0) { 508 | update_kaillera_keys(); 509 | i=1; 510 | } 511 | #endif /* USE_KAILLERA */ 512 | 513 | return i; 514 | } 515 | -------------------------------------------------------------------------------- /sdl/sound.c: -------------------------------------------------------------------------------- 1 | /* 2 | * sound.c 3 | * Copyright (C) 1998 Brainchild Design - http://brainchilddesign.com/ 4 | * 5 | * Copyright (C) 2001 Chuck Mason 6 | * 7 | * Copyright (C) 2002 Florian Schulze 8 | * 9 | * This file is part of Jump'n'Bump. 10 | * 11 | * Jump'n'Bump is free software; you can redistribute it and/or modify 12 | * it under the terms of the GNU General Public License as published by 13 | * the Free Software Foundation; either version 2 of the License, or 14 | * (at your option) any later version. 15 | * 16 | * Jump'n'Bump is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU General Public License for more details. 20 | * 21 | * You should have received a copy of the GNU General Public License 22 | * along with this program; if not, write to the Free Software 23 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 24 | */ 25 | 26 | #include 27 | #include 28 | #include "globals.h" 29 | #include 30 | #ifndef _MSC_VER 31 | #include 32 | #endif 33 | #include 34 | 35 | #ifndef NO_SDL_MIXER 36 | #include 37 | 38 | static Mix_Music *current_music = (Mix_Music *) NULL; 39 | #endif 40 | 41 | #ifdef __SWITCH__ 42 | extern int single_joycon_mode; 43 | extern void update_joycon_mode(); 44 | #endif 45 | 46 | sfx_data sounds[NUM_SFX]; 47 | 48 | static int SAMPLECOUNT = 512; 49 | 50 | #define MAX_CHANNELS 32 51 | 52 | typedef struct { 53 | /* loop flag */ 54 | int loop; 55 | /* The channel step amount... */ 56 | unsigned int step; 57 | /* ... and a 0.16 bit remainder of last step. */ 58 | unsigned int stepremainder; 59 | unsigned int samplerate; 60 | /* The channel data pointers, start and end. */ 61 | signed short* data; 62 | signed short* startdata; 63 | signed short* enddata; 64 | /* Hardware left and right channel volume lookup. */ 65 | int leftvol; 66 | int rightvol; 67 | } channel_info_t; 68 | 69 | channel_info_t channelinfo[MAX_CHANNELS]; 70 | 71 | /* Sample rate in samples/second */ 72 | int audio_rate = 44100; 73 | int global_sfx_volume = 0; 74 | /* 75 | // This function loops all active (internal) sound 76 | // channels, retrieves a given number of samples 77 | // from the raw sound data, modifies it according 78 | // to the current (internal) channel parameters, 79 | // mixes the per channel samples into the given 80 | // mixing buffer, and clamping it to the allowed 81 | // range. 82 | // 83 | // This function currently supports only 16bit. 84 | */ 85 | 86 | static void stopchan(int i) 87 | { 88 | if (channelinfo[i].data) { 89 | memset(&channelinfo[i], 0, sizeof(channel_info_t)); 90 | } 91 | } 92 | 93 | 94 | /* 95 | // This function adds a sound to the 96 | // list of currently active sounds, 97 | // which is maintained as a given number 98 | // (eight, usually) of internal channels. 99 | // Returns a handle. 100 | */ 101 | int addsfx(signed short *data, int len, int loop, int samplerate, int channel) 102 | { 103 | stopchan(channel); 104 | 105 | /* We will handle the new SFX. */ 106 | /* Set pointer to raw data. */ 107 | channelinfo[channel].data = data; 108 | channelinfo[channel].startdata = data; 109 | 110 | /* Set pointer to end of raw data. */ 111 | channelinfo[channel].enddata = channelinfo[channel].data + len - 1; 112 | channelinfo[channel].samplerate = samplerate; 113 | 114 | channelinfo[channel].loop = loop; 115 | channelinfo[channel].stepremainder = 0; 116 | 117 | return channel; 118 | } 119 | 120 | 121 | static void updateSoundParams(int slot, int volume) 122 | { 123 | int rightvol; 124 | int leftvol; 125 | 126 | /* 127 | // Set stepping 128 | // MWM 2000-12-24: Calculates proportion of channel samplerate 129 | // to global samplerate for mixing purposes. 130 | // Patched to shift left *then* divide, to minimize roundoff errors 131 | // as well as to use SAMPLERATE as defined above, not to assume 11025 Hz 132 | */ 133 | channelinfo[slot].step = ((channelinfo[slot].samplerate<<16)/audio_rate); 134 | 135 | leftvol = volume; 136 | rightvol= volume; 137 | 138 | /* Sanity check, clamp volume. */ 139 | if (rightvol < 0) 140 | rightvol = 0; 141 | if (rightvol > 127) 142 | rightvol = 127; 143 | 144 | if (leftvol < 0) 145 | leftvol = 0; 146 | if (leftvol > 127) 147 | leftvol = 127; 148 | 149 | channelinfo[slot].leftvol = leftvol; 150 | channelinfo[slot].rightvol = rightvol; 151 | } 152 | 153 | 154 | void mix_sound(void *unused, Uint8 *stream, int len) 155 | { 156 | /* Mix current sound data. */ 157 | /* Data, from raw sound, for right and left. */ 158 | register int sample; 159 | register int dl; 160 | register int dr; 161 | 162 | /* Pointers in audio stream, left, right, end. */ 163 | signed short* leftout; 164 | signed short* rightout; 165 | signed short* leftend; 166 | /* Step in stream, left and right, thus two. */ 167 | int step; 168 | 169 | /* Mixing channel index. */ 170 | int chan; 171 | 172 | UNUSED(unused); 173 | 174 | /* Left and right channel */ 175 | /* are in audio stream, alternating. */ 176 | leftout = (signed short *)stream; 177 | rightout = ((signed short *)stream)+1; 178 | step = 2; 179 | 180 | /* Determine end, for left channel only */ 181 | /* (right channel is implicit). */ 182 | leftend = leftout + (len/4)*step; 183 | 184 | /* Mix sounds into the mixing buffer. */ 185 | /* Loop over step*SAMPLECOUNT, */ 186 | /* that is 512 values for two channels. */ 187 | while (leftout != leftend) { 188 | /* Reset left/right value. */ 189 | dl = *leftout * 256; 190 | dr = *rightout * 256; 191 | 192 | /* Love thy L2 chache - made this a loop. */ 193 | /* Now more channels could be set at compile time */ 194 | /* as well. Thus loop those channels. */ 195 | for ( chan = 0; chan < MAX_CHANNELS; chan++ ) { 196 | /* Check channel, if active. */ 197 | if (channelinfo[chan].data) { 198 | /* Get the raw data from the channel. */ 199 | /* no filtering */ 200 | /* sample = *channelinfo[chan].data; */ 201 | /* linear filtering */ 202 | sample = (int)(((int)channelinfo[chan].data[0] * (int)(0x10000 - channelinfo[chan].stepremainder)) 203 | + ((int)channelinfo[chan].data[1] * (int)(channelinfo[chan].stepremainder))) >> 16; 204 | 205 | /* Add left and right part */ 206 | /* for this channel (sound) */ 207 | /* to the current data. */ 208 | /* Adjust volume accordingly. */ 209 | dl += sample * (channelinfo[chan].leftvol * global_sfx_volume) / 128; 210 | dr += sample * (channelinfo[chan].rightvol * global_sfx_volume) / 128; 211 | /* Increment index ??? */ 212 | channelinfo[chan].stepremainder += channelinfo[chan].step; 213 | /* MSB is next sample??? */ 214 | channelinfo[chan].data += channelinfo[chan].stepremainder >> 16; 215 | /* Limit to LSB??? */ 216 | channelinfo[chan].stepremainder &= 0xffff; 217 | 218 | /* Check whether we are done. */ 219 | if (channelinfo[chan].data >= channelinfo[chan].enddata) { 220 | if (channelinfo[chan].loop) { 221 | channelinfo[chan].data = channelinfo[chan].startdata; 222 | } else { 223 | stopchan(chan); 224 | } 225 | } 226 | } 227 | } 228 | 229 | /* Clamp to range. Left hardware channel. */ 230 | /* Has been char instead of short. */ 231 | /* if (dl > 127) *leftout = 127; */ 232 | /* else if (dl < -128) *leftout = -128; */ 233 | /* else *leftout = dl; */ 234 | 235 | dl = dl / 256; 236 | dr = dr / 256; 237 | 238 | if (dl > SHRT_MAX) 239 | *leftout = SHRT_MAX; 240 | else if (dl < SHRT_MIN) 241 | *leftout = SHRT_MIN; 242 | else 243 | *leftout = (signed short)dl; 244 | 245 | /* Same for right hardware channel. */ 246 | if (dr > SHRT_MAX) 247 | *rightout = SHRT_MAX; 248 | else if (dr < SHRT_MIN) 249 | *rightout = SHRT_MIN; 250 | else 251 | *rightout = (signed short)dr; 252 | 253 | /* Increment current pointers in stream */ 254 | leftout += step; 255 | rightout += step; 256 | } 257 | } 258 | 259 | /* misc handling */ 260 | 261 | char dj_init(void) 262 | { 263 | #ifndef NO_SDL_MIXER 264 | Uint16 audio_format = MIX_DEFAULT_FORMAT; 265 | int audio_channels = 2; 266 | #endif 267 | int audio_buffers = 4096; 268 | 269 | open_screen(); 270 | 271 | if (main_info.no_sound) 272 | return 0; 273 | 274 | audio_buffers = SAMPLECOUNT*audio_rate/11025; 275 | 276 | memset(channelinfo, 0, sizeof(channelinfo)); 277 | memset(sounds, 0, sizeof(sounds)); 278 | 279 | #ifndef NO_SDL_MIXER 280 | if (Mix_OpenAudio(audio_rate, audio_format, audio_channels, audio_buffers) < 0) { 281 | fprintf(stderr, "Couldn't open audio: %s\n", SDL_GetError()); 282 | main_info.no_sound = 1; 283 | return 1; 284 | } 285 | 286 | Mix_QuerySpec(&audio_rate, &audio_format, &audio_channels); 287 | printf("Opened audio at %dHz %dbit %s, %d bytes audio buffer\n", audio_rate, (audio_format & 0xFF), (audio_channels > 1) ? "stereo" : "mono", audio_buffers); 288 | 289 | Mix_SetMusicCMD(getenv("MUSIC_CMD")); 290 | 291 | Mix_SetPostMix(mix_sound, NULL); 292 | #else 293 | main_info.no_sound = 1; 294 | return 1; 295 | #endif 296 | 297 | return 0; 298 | } 299 | 300 | void dj_deinit(void) 301 | { 302 | if (main_info.no_sound) 303 | return; 304 | 305 | #ifndef NO_SDL_MIXER 306 | Mix_HaltMusic(); 307 | if (current_music) 308 | Mix_FreeMusic(current_music); 309 | current_music = NULL; 310 | 311 | Mix_CloseAudio(); 312 | #endif 313 | 314 | #ifdef __SWITCH__ 315 | // on quit, recombine any split joycons again 316 | single_joycon_mode = 0; 317 | update_joycon_mode(); 318 | #endif 319 | 320 | SDL_Quit(); 321 | } 322 | 323 | /* mix handling */ 324 | 325 | void dj_mix(void) 326 | { 327 | } 328 | 329 | /* sfx handling */ 330 | 331 | char dj_set_num_sfx_channels(char num_channels) 332 | { 333 | return num_channels; 334 | } 335 | 336 | void dj_set_sfx_volume(char volume) 337 | { 338 | if (main_info.no_sound) 339 | return; 340 | 341 | SDL_LockAudio(); 342 | global_sfx_volume = volume*2; 343 | SDL_UnlockAudio(); 344 | } 345 | 346 | void dj_play_sfx(unsigned char sfx_num, unsigned short freq, char volume, signed char channel) 347 | { 348 | int slot; 349 | 350 | if (main_info.music_no_sound || main_info.no_sound) 351 | return; 352 | 353 | if (channel<0) { 354 | for (slot=0; slot=MAX_CHANNELS) 358 | return; 359 | } else 360 | slot = channel; 361 | 362 | SDL_LockAudio(); 363 | addsfx((short *)sounds[sfx_num].buf, sounds[sfx_num].length, sounds[sfx_num].loop, freq, slot); 364 | updateSoundParams(slot, volume*2); 365 | SDL_UnlockAudio(); 366 | } 367 | 368 | char dj_get_sfx_settings(unsigned char sfx_num, sfx_data *data) 369 | { 370 | if (main_info.no_sound) 371 | return 0; 372 | 373 | memcpy(data, &sounds[sfx_num], sizeof(sfx_data)); 374 | return 0; 375 | } 376 | 377 | char dj_set_sfx_settings(unsigned char sfx_num, sfx_data *data) 378 | { 379 | if (main_info.no_sound) 380 | return 0; 381 | 382 | memcpy(&sounds[sfx_num], data, sizeof(sfx_data)); 383 | return 0; 384 | } 385 | 386 | void dj_set_sfx_channel_volume(char channel_num, char volume) 387 | { 388 | if (main_info.no_sound) 389 | return; 390 | 391 | SDL_LockAudio(); 392 | updateSoundParams(channel_num, volume*2); 393 | SDL_UnlockAudio(); 394 | } 395 | 396 | void dj_stop_sfx_channel(char channel_num) 397 | { 398 | if (main_info.no_sound) 399 | return; 400 | 401 | SDL_LockAudio(); 402 | stopchan(channel_num); 403 | SDL_UnlockAudio(); 404 | } 405 | 406 | char dj_load_sfx(unsigned char * file_handle, int file_length, unsigned char sfx_num) 407 | { 408 | unsigned int i; 409 | unsigned char *src; 410 | unsigned short *dest; 411 | 412 | if (main_info.no_sound) 413 | return 0; 414 | 415 | sounds[sfx_num].buf = malloc(file_length); 416 | 417 | memcpy(sounds[sfx_num].buf, file_handle, file_length); 418 | 419 | sounds[sfx_num].length = file_length / 2; 420 | src = sounds[sfx_num].buf; 421 | dest = (unsigned short *)sounds[sfx_num].buf; 422 | for (i=0; i c #D6D6D6", 17 | ", c #FB8E24", 18 | "' c #4A2A1A", 19 | ") c #E6E6E6", 20 | "! c #CE7222", 21 | "~ c #505252", 22 | "{ c #A15A1F", 23 | "] c #F79B37", 24 | "^ c #FEB666", 25 | "/ c #AE5A0A", 26 | "( c #D66C16", 27 | "_ c #DE6A18", 28 | ": c #EFEEEE", 29 | "< c #7A0202", 30 | "[ c #FEA640", 31 | "} c #664833", 32 | "| c #CCA085", 33 | "1 c #2A2A32", 34 | "2 c #895F38", 35 | "3 c #3C3A3F", 36 | "4 c #EAAE7C", 37 | "5 c #A8805B", 38 | "6 c #9E9E9E", 39 | "7 c #FEC68E", 40 | "8 c #BB5E0F", 41 | "9 c #EE3A3A", 42 | "0 c #AF5207", 43 | "a c #FEAE42", 44 | "b c #5A2A02", 45 | "c c #F8F6F9", 46 | "d c #636262", 47 | "e c #CB6312", 48 | "f c #E67215", 49 | "g c #8E4202", 50 | "h c #1D1C20", 51 | "i c #6A3202", 52 | "j c #7A685D", 53 | "k c #A4500C", 54 | "l c #F5781A", 55 | "m c #7A7A7A", 56 | "n c #F6CEA6", 57 | "o c #4A4242", 58 | "p c #FEDEBF", 59 | "q c #FDFEFD", 60 | "r c #D67A3A", 61 | "s c #FDA64D", 62 | "t c #7A3A02", 63 | "u c #B64242", 64 | "v c #FE7A12", 65 | "w c #6A6A6A", 66 | "x c #DE7A2A", 67 | "y c #150D0C", 68 | "z c #FEAE4C", 69 | " ", 70 | " ", 71 | " ", 72 | " ", 73 | " ", 74 | " ", 75 | " ", 76 | " ", 77 | " ", 78 | " ", 79 | " ", 80 | " ", 81 | " ", 82 | " ", 83 | " ", 84 | " ", 85 | " ", 86 | " ", 87 | " ", 88 | " ", 89 | " 6;;66 ", 90 | " 6;;66 ", 91 | " 6;;;## ", 92 | " mm 6;;;#### ", 93 | " ##m mm;#dwmm ", 94 | " ##m mm;mw#mm ", 95 | " %%%~ m;;;#~% ", 96 | " mm#=66 ~~~3 ;66#dmm ", 97 | " ;;m+6666 ~~~3 #6;;%w66 ", 98 | " ;;m+;666 + ~~~~3 #;;;%w66 ", 99 | " ;;m+66;6 + ~~~~3 #6;;~w66 ", 100 | " 666+++::66 66d6 ~%~~o m;6~%d6 ", 101 | " 6>;;==qq6 +##~; ~%~%3w #6m~~; ", 102 | " 6:++mm::6 +;ddw6 ~~dd1~ ;;m6#mm6 ", 103 | " 6)++mm::6 +;ddw6 ~~dd1~ ;;m6wmm6 ", 104 | " 6c::##==q6 ==;mddm+ ~%ww33 ;;;;;w666 ", 105 | " ;)qq++66q6 ++6mmm+= %%##%o mmm6;m66; ", 106 | " 6=qq))66:6 7744=+++666+ %%###m66 mm#6;;66 ", 107 | " 6=qq))66)6 7744=+++666+ %%###m66 mmm6m;66 ", 108 | " 6qqcc==)q66[]]]||===>=++= %om#m;;;;mmm6;;6; ", 109 | " 4;::qq))>q66z[4z==>)))===> 33wwmmmmd;;;6;;;; ", 110 | " 4;::qq))>q66a[44==>)))===> 3w#mmmmd;;;6;;;; ", 111 | " 4;::qq))>q66s[44==>)))===> 3wwmmmmd;;;6;;;; ", 112 | " za[[]5))cccc:cqq^[==>>)cc>=>>n^ 1%%mmmm#;;;m;m55 ", 113 | " xszz[[[[[[[aa[|++ccqqcqqqn4==))c))>>==^]77|.oo#mmm##mm;;m55r{}2 ", 114 | " e8zzaz[aa[s[sss[]jj==qqqqqqp=))::c)))>44s[[s,y11w###m;;;66666m1y.ii&&, ", 115 | " 8ezzaas[a[sa[^sz]#j==qqqqqqp=))::c)))>44ss[s,.11d###m;;;66666m1.yii&&& ", 116 | " 22]z[[z[[aas[^^77r|++ccqqqq:>))ccq::>=^4s[,,lb..ow##m;666;;666#yhxx&&&lvv, ", 117 | " /zzzzzz[[z^zsn:ppccqqqcqqq:ccqqc))=^ss]&!!!*hh~w##;66666hw#+633tt,&&&&&&&&,,, ", 118 | " txsszszsz^z77pcqqqqqqqqqqqqqqqqc))n]fffe88}}%ddw##;666661.y66mm''&&&&&&&&&&&&&&&] ", 119 | " ta[zzz^^^7ppcqqqqqqqqqqqqqqqqqcqq4r_((822~~~~%w##m;m;6+w..d+66~}ff&&v&v&&&v&&v&&vlv ", 120 | " t[[zza^^^7ppcqqqqqqqqcqqqqqqqqcqq4!((!822}~~~%d##m;;;6+w..%+66~}lf&&&&&v&&&&&&&&vvv ", 121 | " 'ee^aaazs^:cqqqqqqqqqqqqqqqqqqqqqc^!!e0}t11oo%d##m;;;;6611166;ddflv&&,&&&v&&&&,&vs] ", 122 | " '!!^zzzss^::qqqqqqqqqqqqqcqqqqqqqc^!!ekt}11oo%d##m;;;66611h6662j_l&&,,&&&&&&,,]&x ", 123 | " bb,zszzs^::qqqqqqqqqqqqqqqqqqcqqqn!!e{''yh33%dwwm;;;;;6%dh666jjxx&&,&&v&&&&&&&& ", 124 | " bb]zzzzz^::qqqqqqqqcqqqqqqqqqqqqqn!!ek''yy33%dwwm;m;;;6ddy666#jxxv&&,&&,,x&,&&& ", 125 | " gzzs^s=))qqcc::qqqqccqqqqqqqccqq]]e{**yy33~%dd#mmm;;;mm3;;;mmrr],&&&,]]&,&&] ", 126 | " *//lfr=::cq6666qqqqqqcqqqqqqqqqc44eg...h33o~%%wmm#m#;;;;;;;mm''g_&&,&&,vvss ", 127 | " ikkffx+>>))hh66qqq:;;=qqqqqcqqqq77!g.y.13oo~~%w####mm;;;m55uubb**bb{8eess ", 128 | " ik0ffr+>>))hy66qqq:;;=qqqqqcqqqq77!gy..1ooo~%%d####m#;;;;;5uubby*bbkeeess ", 129 | " g00_fllvvvvlvr++);..::qqq;..>qqqqqqqqqqnnx0*y.1333o%%%ddww##w#m#99@@tttibb*b00&x ", 130 | " kgkl&vvvvlvlvv&lvlrr|~yyccqqq~yhcqqqqqqqqqqnnx8**11*h13oo~%%%ddwwd%2--$$bbgkeef,]]]]zz ", 131 | " t8vvvvvvvvvvvvvv&l822ppccc.ddqqqqqqqqqc:44!eii*yyyh133o~~~%~~oo~o<>>|!feekg*.....y*t!x!l,]s[sz[[[[[[s][[][[[[[[[[]z ", 137 | " {{(vlvvvvll&vvvllvvlv&&^ccccc:>>>|r!eekk*.....*ytf!fl,][[[z[[[[[[[s[[[[[][[[[[]z ", 138 | " ikklf&v&lvvvlvvlvvlvvl,44===>>|!ee__ib..**gevv][sszz[zz[[[[s][[[[[[][[[[[[[[[, ", 139 | " ibi**/&&&vvvl&vllvvvvllvv&l4|4re_(e_gg{l]][saazss[a[z[[s[s]zs[]s[[[[[[[[][[[[[]] ", 140 | " iiiiiiiiiff&,&&lv&vlvllv&lll&l(_((fff&[[aszzasaas[aasa[sz[z[[[[s[[[[[[[[[[[[[[[[[[[ ", 141 | " iiiiiiiiiff&&&&vlvvvvv&v&lllll__f_ffl&[[asazzsaasaaasa[zz[z[[[[[[[]s[[][[[[[[[[[[[[ ", 142 | " iiiiiiiii**i8&&lv&&&&vlvf00ttbbb0e!fazssazzzs[ssaaa[sasaaszs][[azs[[[[s[[s][[[[[[[[ ", 143 | " iiiiiiiiibiiiii((vvfe{kbiiiiiibbkekk]zzzzzasaz[[z[[[a[[zs[[zzs[sz[as]z[[]zs[s[[[[[[[ ", 144 | " iiiiiiiiiiiiiiiiibb*iiiiiiiiiiii/_kk!zzzsszzzsaszzzz[z[aaaszs[[aaszss[sza[][[][][[], ", 145 | " iiiiiiiiiiiiiiiiibb*iiiiiiiiiiii8_kkezzzssazzszazszs[z[aaz[zz[[aasass[saa[s[[s[][[]] ", 146 | " iiiiiiiiiiiiiiiiibi*iiiiiiiiiiii/_kk!zzzzszzzzzzzazz]z[aaz[zzs]a[sas][saa[[[[[[]]] ", 147 | " iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiitt8f//0sszzzzzzszzzzzz[sassas[assaaz]zas[[ass][&! ", 148 | " iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiitte(eek!^^szzzsz[szazzzzs[[saaz[[zz[za]za[sx,!5d# ", 149 | " iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiitte(eek!^aaazzzzs]szzzzasaasazz[[zz[z[[sa[[,r58dw ", 150 | " iiib-iiiiiiiiiiiiiiiiiiiiiiiiiitt_fee/k]]szzzzzzzszzazzz[[asaas]aazz[[]r5m#www#wd ", 151 | " iiiiiibiiiiiiiiiiiiiiiiiiiiiiiigke__(/k//zszzzszzzss]szzssz[zszz[[,!88k2dd#mwww ", 152 | " iiiiiib-iiiiiiiiiiiiiiiiiiiiiiikg(e((8kkk!^szzzsszszzzazzszz[[xx08kk00kwm#ww ", 153 | " iiiiiiiibiiiiiiiiiiiiiiiiiiiiii0k_(((e0k0k]z^[zzzzzzzszszz,!/8k/k00000{w##ww ", 154 | " iiiiiiiiiiib-iiiib-iiib-iiiiiiik0_(((8000g]^^szazzszzzzzzz]!80kk000000{w##ww ", 155 | " iiiiiiiiiiiiibiiiiibiiiiibiiiii08(e((e0//k/[[zsszzzzz],r880k00000000002#m#wwmm ", 156 | " iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiie8(e((e0//0k88s^]]x8//k0k00000000000000######w#w ", 157 | " iiiiiiiiiiiiiiiiiiiiiiiiii-biii88(e((e///0k8ezz]]r08/00/000/000k000000j##m##www; ", 158 | " iiiiiib-iiiiiiiiiiiiiiiiiiiiiii8e_e((e0//0ge8sz]]x/8/0kkk0k0k0000k0000######w#w; ", 159 | " iiiiiibi-biiiiiiiiiiiiiiiiit!!(e((e/k/0/kk{e{0k000000000000k0000k{/w#w######w# ", 160 | " iiiiiiiiiiiib-iiiiiiiiiiiit8e(ee(e/k0/{k0kkkk/kkk00/0k000k/0000022#w#########ww ", 161 | " iiiiiiiiiibiiiiibiiiiikeeeeeee8//k/00/k//00000k0000k0000k0{2jj#############w ", 162 | " iiiiiiiiib-iiiiiiiiiiigeeeeeee8//k/00/k//00k00000000000000{2jj#w############ ", 163 | " iiiiiiiiiiibiiiiiiiiik__!eeee8kk//kk/0/0//kk00k0k/k00{{2jw#m######w#ww#wwwww ", 164 | " b-iiiiiiiii-iiiiiiii0e(eeeeeekk/k00/k0k0kkk000000{22jj##################ww# ", 165 | " iiiiiiiiibiiiiiiii/eeeeee8e00k/kk0k00k/k00/k{{jw##wwww############www;; ", 166 | " iiiiiiiiiiiiiiiiii8ee8ee(8e00//kk0kk0k00k000{{jw#mwwww##m#########w#w;; ", 167 | " iiiiiiiiiiiiiiii0eeee88ee000/kk/k0/k000k2jww#w##w#######ww#####w# ", 168 | " iiiiiiiiiiiiii!eee8!8(888kk/00000k2j2j##ww#www###www#w#mw#dw ", 169 | " iiiiiii-biiiieeee8eee888kk0k000/k2j2###ww#ww###wwwwww#m ", 170 | " iiiibiiiiiiii!eee8eeee88kk000k0k{222j##wwmwww##w#wwwwwm ", 171 | " iiiiiiibtte88!888/80000kk{222#www#ww##ww##wwdd#; ", 172 | " iiiibbgk88e88e880!e{jjjw#ww##wwwmwww#wdd## ", 173 | " tbbbkg!88/0//x wwww#www##mww##wdm ", 174 | " tbbkk088! wwww##wwww#dw;; ", 175 | " }bbk/088! wwww##w#ww#dw;; ", 176 | " 88 ww#wwddd# ", 177 | " www# ", 178 | " ", 179 | " ", 180 | " ", 181 | " ", 182 | " ", 183 | " ", 184 | " ", 185 | " ", 186 | " ", 187 | " ", 188 | " ", 189 | " ", 190 | " ", 191 | " ", 192 | " ", 193 | " ", 194 | " ", 195 | " ", 196 | " "}; 197 | -------------------------------------------------------------------------------- /COPYING: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 2, June 1991 3 | 4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc. 5 | 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 6 | Everyone is permitted to copy and distribute verbatim copies 7 | of this license document, but changing it is not allowed. 8 | 9 | Preamble 10 | 11 | The licenses for most software are designed to take away your 12 | freedom to share and change it. By contrast, the GNU General Public 13 | License is intended to guarantee your freedom to share and change free 14 | software--to make sure the software is free for all its users. This 15 | General Public License applies to most of the Free Software 16 | Foundation's software and to any other program whose authors commit to 17 | using it. (Some other Free Software Foundation software is covered by 18 | the GNU Library General Public License instead.) You can apply it to 19 | your programs, too. 20 | 21 | When we speak of free software, we are referring to freedom, not 22 | price. Our General Public Licenses are designed to make sure that you 23 | have the freedom to distribute copies of free software (and charge for 24 | this service if you wish), that you receive source code or can get it 25 | if you want it, that you can change the software or use pieces of it 26 | in new free programs; and that you know you can do these things. 27 | 28 | To protect your rights, we need to make restrictions that forbid 29 | anyone to deny you these rights or to ask you to surrender the rights. 30 | These restrictions translate to certain responsibilities for you if you 31 | distribute copies of the software, or if you modify it. 32 | 33 | For example, if you distribute copies of such a program, whether 34 | gratis or for a fee, you must give the recipients all the rights that 35 | you have. You must make sure that they, too, receive or can get the 36 | source code. And you must show them these terms so they know their 37 | rights. 38 | 39 | We protect your rights with two steps: (1) copyright the software, and 40 | (2) offer you this license which gives you legal permission to copy, 41 | distribute and/or modify the software. 42 | 43 | Also, for each author's protection and ours, we want to make certain 44 | that everyone understands that there is no warranty for this free 45 | software. If the software is modified by someone else and passed on, we 46 | want its recipients to know that what they have is not the original, so 47 | that any problems introduced by others will not reflect on the original 48 | authors' reputations. 49 | 50 | Finally, any free program is threatened constantly by software 51 | patents. We wish to avoid the danger that redistributors of a free 52 | program will individually obtain patent licenses, in effect making the 53 | program proprietary. To prevent this, we have made it clear that any 54 | patent must be licensed for everyone's free use or not licensed at all. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | GNU GENERAL PUBLIC LICENSE 60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 61 | 62 | 0. This License applies to any program or other work which contains 63 | a notice placed by the copyright holder saying it may be distributed 64 | under the terms of this General Public License. The "Program", below, 65 | refers to any such program or work, and a "work based on the Program" 66 | means either the Program or any derivative work under copyright law: 67 | that is to say, a work containing the Program or a portion of it, 68 | either verbatim or with modifications and/or translated into another 69 | language. (Hereinafter, translation is included without limitation in 70 | the term "modification".) Each licensee is addressed as "you". 71 | 72 | Activities other than copying, distribution and modification are not 73 | covered by this License; they are outside its scope. The act of 74 | running the Program is not restricted, and the output from the Program 75 | is covered only if its contents constitute a work based on the 76 | Program (independent of having been made by running the Program). 77 | Whether that is true depends on what the Program does. 78 | 79 | 1. You may copy and distribute verbatim copies of the Program's 80 | source code as you receive it, in any medium, provided that you 81 | conspicuously and appropriately publish on each copy an appropriate 82 | copyright notice and disclaimer of warranty; keep intact all the 83 | notices that refer to this License and to the absence of any warranty; 84 | and give any other recipients of the Program a copy of this License 85 | along with the Program. 86 | 87 | You may charge a fee for the physical act of transferring a copy, and 88 | you may at your option offer warranty protection in exchange for a fee. 89 | 90 | 2. You may modify your copy or copies of the Program or any portion 91 | of it, thus forming a work based on the Program, and copy and 92 | distribute such modifications or work under the terms of Section 1 93 | above, provided that you also meet all of these conditions: 94 | 95 | a) You must cause the modified files to carry prominent notices 96 | stating that you changed the files and the date of any change. 97 | 98 | b) You must cause any work that you distribute or publish, that in 99 | whole or in part contains or is derived from the Program or any 100 | part thereof, to be licensed as a whole at no charge to all third 101 | parties under the terms of this License. 102 | 103 | c) If the modified program normally reads commands interactively 104 | when run, you must cause it, when started running for such 105 | interactive use in the most ordinary way, to print or display an 106 | announcement including an appropriate copyright notice and a 107 | notice that there is no warranty (or else, saying that you provide 108 | a warranty) and that users may redistribute the program under 109 | these conditions, and telling the user how to view a copy of this 110 | License. (Exception: if the Program itself is interactive but 111 | does not normally print such an announcement, your work based on 112 | the Program is not required to print an announcement.) 113 | 114 | These requirements apply to the modified work as a whole. If 115 | identifiable sections of that work are not derived from the Program, 116 | and can be reasonably considered independent and separate works in 117 | themselves, then this License, and its terms, do not apply to those 118 | sections when you distribute them as separate works. But when you 119 | distribute the same sections as part of a whole which is a work based 120 | on the Program, the distribution of the whole must be on the terms of 121 | this License, whose permissions for other licensees extend to the 122 | entire whole, and thus to each and every part regardless of who wrote it. 123 | 124 | Thus, it is not the intent of this section to claim rights or contest 125 | your rights to work written entirely by you; rather, the intent is to 126 | exercise the right to control the distribution of derivative or 127 | collective works based on the Program. 128 | 129 | In addition, mere aggregation of another work not based on the Program 130 | with the Program (or with a work based on the Program) on a volume of 131 | a storage or distribution medium does not bring the other work under 132 | the scope of this License. 133 | 134 | 3. You may copy and distribute the Program (or a work based on it, 135 | under Section 2) in object code or executable form under the terms of 136 | Sections 1 and 2 above provided that you also do one of the following: 137 | 138 | a) Accompany it with the complete corresponding machine-readable 139 | source code, which must be distributed under the terms of Sections 140 | 1 and 2 above on a medium customarily used for software interchange; or, 141 | 142 | b) Accompany it with a written offer, valid for at least three 143 | years, to give any third party, for a charge no more than your 144 | cost of physically performing source distribution, a complete 145 | machine-readable copy of the corresponding source code, to be 146 | distributed under the terms of Sections 1 and 2 above on a medium 147 | customarily used for software interchange; or, 148 | 149 | c) Accompany it with the information you received as to the offer 150 | to distribute corresponding source code. (This alternative is 151 | allowed only for noncommercial distribution and only if you 152 | received the program in object code or executable form with such 153 | an offer, in accord with Subsection b above.) 154 | 155 | The source code for a work means the preferred form of the work for 156 | making modifications to it. For an executable work, complete source 157 | code means all the source code for all modules it contains, plus any 158 | associated interface definition files, plus the scripts used to 159 | control compilation and installation of the executable. However, as a 160 | special exception, the source code distributed need not include 161 | anything that is normally distributed (in either source or binary 162 | form) with the major components (compiler, kernel, and so on) of the 163 | operating system on which the executable runs, unless that component 164 | itself accompanies the executable. 165 | 166 | If distribution of executable or object code is made by offering 167 | access to copy from a designated place, then offering equivalent 168 | access to copy the source code from the same place counts as 169 | distribution of the source code, even though third parties are not 170 | compelled to copy the source along with the object code. 171 | 172 | 4. You may not copy, modify, sublicense, or distribute the Program 173 | except as expressly provided under this License. Any attempt 174 | otherwise to copy, modify, sublicense or distribute the Program is 175 | void, and will automatically terminate your rights under this License. 176 | However, parties who have received copies, or rights, from you under 177 | this License will not have their licenses terminated so long as such 178 | parties remain in full compliance. 179 | 180 | 5. You are not required to accept this License, since you have not 181 | signed it. However, nothing else grants you permission to modify or 182 | distribute the Program or its derivative works. These actions are 183 | prohibited by law if you do not accept this License. Therefore, by 184 | modifying or distributing the Program (or any work based on the 185 | Program), you indicate your acceptance of this License to do so, and 186 | all its terms and conditions for copying, distributing or modifying 187 | the Program or works based on it. 188 | 189 | 6. Each time you redistribute the Program (or any work based on the 190 | Program), the recipient automatically receives a license from the 191 | original licensor to copy, distribute or modify the Program subject to 192 | these terms and conditions. You may not impose any further 193 | restrictions on the recipients' exercise of the rights granted herein. 194 | You are not responsible for enforcing compliance by third parties to 195 | this License. 196 | 197 | 7. If, as a consequence of a court judgment or allegation of patent 198 | infringement or for any other reason (not limited to patent issues), 199 | conditions are imposed on you (whether by court order, agreement or 200 | otherwise) that contradict the conditions of this License, they do not 201 | excuse you from the conditions of this License. If you cannot 202 | distribute so as to satisfy simultaneously your obligations under this 203 | License and any other pertinent obligations, then as a consequence you 204 | may not distribute the Program at all. For example, if a patent 205 | license would not permit royalty-free redistribution of the Program by 206 | all those who receive copies directly or indirectly through you, then 207 | the only way you could satisfy both it and this License would be to 208 | refrain entirely from distribution of the Program. 209 | 210 | If any portion of this section is held invalid or unenforceable under 211 | any particular circumstance, the balance of the section is intended to 212 | apply and the section as a whole is intended to apply in other 213 | circumstances. 214 | 215 | It is not the purpose of this section to induce you to infringe any 216 | patents or other property right claims or to contest validity of any 217 | such claims; this section has the sole purpose of protecting the 218 | integrity of the free software distribution system, which is 219 | implemented by public license practices. Many people have made 220 | generous contributions to the wide range of software distributed 221 | through that system in reliance on consistent application of that 222 | system; it is up to the author/donor to decide if he or she is willing 223 | to distribute software through any other system and a licensee cannot 224 | impose that choice. 225 | 226 | This section is intended to make thoroughly clear what is believed to 227 | be a consequence of the rest of this License. 228 | 229 | 8. If the distribution and/or use of the Program is restricted in 230 | certain countries either by patents or by copyrighted interfaces, the 231 | original copyright holder who places the Program under this License 232 | may add an explicit geographical distribution limitation excluding 233 | those countries, so that distribution is permitted only in or among 234 | countries not thus excluded. In such case, this License incorporates 235 | the limitation as if written in the body of this License. 236 | 237 | 9. The Free Software Foundation may publish revised and/or new versions 238 | of the General Public License from time to time. Such new versions will 239 | be similar in spirit to the present version, but may differ in detail to 240 | address new problems or concerns. 241 | 242 | Each version is given a distinguishing version number. If the Program 243 | specifies a version number of this License which applies to it and "any 244 | later version", you have the option of following the terms and conditions 245 | either of that version or of any later version published by the Free 246 | Software Foundation. If the Program does not specify a version number of 247 | this License, you may choose any version ever published by the Free Software 248 | Foundation. 249 | 250 | 10. If you wish to incorporate parts of the Program into other free 251 | programs whose distribution conditions are different, write to the author 252 | to ask for permission. For software which is copyrighted by the Free 253 | Software Foundation, write to the Free Software Foundation; we sometimes 254 | make exceptions for this. Our decision will be guided by the two goals 255 | of preserving the free status of all derivatives of our free software and 256 | of promoting the sharing and reuse of software generally. 257 | 258 | NO WARRANTY 259 | 260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN 262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED 264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS 266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE 267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, 268 | REPAIR OR CORRECTION. 269 | 270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED 275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY 276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 278 | POSSIBILITY OF SUCH DAMAGES. 279 | 280 | END OF TERMS AND CONDITIONS 281 | 282 | How to Apply These Terms to Your New Programs 283 | 284 | If you develop a new program, and you want it to be of the greatest 285 | possible use to the public, the best way to achieve this is to make it 286 | free software which everyone can redistribute and change under these terms. 287 | 288 | To do so, attach the following notices to the program. It is safest 289 | to attach them to the start of each source file to most effectively 290 | convey the exclusion of warranty; and each file should have at least 291 | the "copyright" line and a pointer to where the full notice is found. 292 | 293 | 294 | Copyright (C) 295 | 296 | This program is free software; you can redistribute it and/or modify 297 | it under the terms of the GNU General Public License as published by 298 | the Free Software Foundation; either version 2 of the License, or 299 | (at your option) any later version. 300 | 301 | This program is distributed in the hope that it will be useful, 302 | but WITHOUT ANY WARRANTY; without even the implied warranty of 303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 304 | GNU General Public License for more details. 305 | 306 | You should have received a copy of the GNU General Public License 307 | along with this program; if not, write to the Free Software 308 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 309 | 310 | 311 | Also add information on how to contact you by electronic and paper mail. 312 | 313 | If the program is interactive, make it output a short notice like this 314 | when it starts in an interactive mode: 315 | 316 | Gnomovision version 69, Copyright (C) year name of author 317 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 318 | This is free software, and you are welcome to redistribute it 319 | under certain conditions; type `show c' for details. 320 | 321 | The hypothetical commands `show w' and `show c' should show the appropriate 322 | parts of the General Public License. Of course, the commands you use may 323 | be called something other than `show w' and `show c'; they could even be 324 | mouse-clicks or menu items--whatever suits your program. 325 | 326 | You should also get your employer (if you work as a programmer) or your 327 | school, if any, to sign a "copyright disclaimer" for the program, if 328 | necessary. Here is a sample; alter the names: 329 | 330 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program 331 | `Gnomovision' (which makes passes at compilers) written by James Hacker. 332 | 333 | , 1 April 1989 334 | Ty Coon, President of Vice 335 | 336 | This General Public License does not permit incorporating your program into 337 | proprietary programs. If your program is a subroutine library, you may 338 | consider it more useful to permit linking proprietary applications with the 339 | library. If this is what you want to do, use the GNU Library General 340 | Public License instead of this License. 341 | -------------------------------------------------------------------------------- /menu.c: -------------------------------------------------------------------------------- 1 | /* 2 | * menu.c 3 | * Copyright (C) 1998 Brainchild Design - http://brainchilddesign.com/ 4 | * 5 | * Copyright (C) 2001 Chuck Mason 6 | * 7 | * Copyright (C) 2002 Florian Schulze 8 | * 9 | * This file is part of Jump'n'Bump. 10 | * 11 | * Jump'n'Bump is free software; you can redistribute it and/or modify 12 | * it under the terms of the GNU General Public License as published by 13 | * the Free Software Foundation; either version 2 of the License, or 14 | * (at your option) any later version. 15 | * 16 | * Jump'n'Bump is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU General Public License for more details. 20 | * 21 | * You should have received a copy of the GNU General Public License 22 | * along with this program; if not, write to the Free Software 23 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 24 | */ 25 | 26 | #include "globals.h" 27 | #include "version.h" 28 | 29 | char *menu_background; 30 | 31 | char menu_pal[768]; 32 | char menu_cur_pal[768]; 33 | 34 | char *message[] = { 35 | "Jump 'n Bump "JNB_VERSION, 36 | "by Brainchild Design in 1998.", 37 | "Code by Mattias Brynervall.", 38 | "Graphics by Martin Magnusson", 39 | "and Andreas Brynervall.", 40 | "Music by Anders Nilsson.", 41 | "Linux port by Chuck Mason.", 42 | "New SDL port by Florian Schulze.", 43 | "http://www.icculus.org/jumpnbump/", 44 | "Ryan C. Gordon made networking possible again!", 45 | "SDL2, Android, WinRT and iOS port by Felix Haedicke.", 46 | "http://github.com/felixhaedicke/jumpnbump", 47 | "Jump 'n Bump is e-mailware.", 48 | "That means you're supposed to send us an e-mail!", 49 | "Write for example where you're from", 50 | "and what you thought about this game.", 51 | "If you do that, you will greatly encourage us", 52 | "to make more games for you!", 53 | "Send your e-mail to: matbr656@student.liu.se", 54 | "Oh, and by the way, there're a lot of secrets!", 55 | "If you can't find them, you'd better ask us...", 56 | "If you'd like to contact a specific member of BCD,", 57 | "these are their e-mail addresses:", 58 | "Andreas Brynervall: andreasb@acc.umu.se", 59 | "Mattias Brynervall: matbr656@student.liu.se", 60 | "Martin Magnusson: marma102@student.liu.se", 61 | "Anders Nilsson: equel@swipnet.se", 62 | "" 63 | }; 64 | 65 | #define NUM_MESSAGES (sizeof(message)/sizeof(char *)) 66 | 67 | int menu(void) 68 | { 69 | int c1; 70 | int esc_pressed; 71 | int end_loop_flag, new_game_flag, fade_flag; 72 | int mod_vol = 0, mod_fade_direction = 0; 73 | unsigned int cur_message; 74 | int fade_dir, fade_count; 75 | char fade_pal[48]; 76 | int update_count; 77 | 78 | if (menu_init() != 0) 79 | return 1; 80 | 81 | /* After a game, we have to release the keys, cause AI player 82 | can still be using them */ 83 | addkey((KEY_PL1_LEFT & 0x7f) | 0x8000); 84 | addkey((KEY_PL2_LEFT & 0x7f) | 0x8000); 85 | addkey((KEY_PL3_LEFT & 0x7f) | 0x8000); 86 | addkey((KEY_PL4_LEFT & 0x7f) | 0x8000); 87 | 88 | addkey((KEY_PL1_RIGHT & 0x7f) | 0x8000); 89 | addkey((KEY_PL2_RIGHT & 0x7f) | 0x8000); 90 | addkey((KEY_PL3_RIGHT & 0x7f) | 0x8000); 91 | addkey((KEY_PL4_RIGHT & 0x7f) | 0x8000); 92 | 93 | addkey((KEY_PL1_JUMP & 0x7f) | 0x8000); 94 | addkey((KEY_PL2_JUMP & 0x7f) | 0x8000); 95 | addkey((KEY_PL3_JUMP & 0x7f) | 0x8000); 96 | addkey((KEY_PL4_JUMP & 0x7f) | 0x8000); 97 | 98 | mod_vol = 0; 99 | mod_fade_direction = 1; 100 | dj_ready_mod(MOD_MENU); 101 | dj_set_mod_volume((char)mod_vol); 102 | dj_set_sfx_volume(64); 103 | dj_start_mod(); 104 | 105 | memset(fade_pal, 0, 48); 106 | setpalette(240, 16, fade_pal); 107 | 108 | fade_dir = 0; 109 | fade_count = 0; 110 | cur_message = NUM_MESSAGES - 1; 111 | 112 | main_info.page_info[0].num_pobs = 0; 113 | main_info.page_info[1].num_pobs = 0; 114 | main_info.view_page = 0; 115 | main_info.draw_page = 1; 116 | 117 | esc_pressed = key_pressed(1); 118 | end_loop_flag = new_game_flag = 0; 119 | 120 | update_count = 1; 121 | while (1) { 122 | 123 | dj_mix(); 124 | 125 | for(c1 = 0; c1 < JNB_MAX_PLAYERS; c1++) // set AI to false 126 | ai[c1] = 0; 127 | 128 | while (update_count) { 129 | 130 | if (key_pressed(1) == 1 && esc_pressed == 0) { 131 | end_loop_flag = 1; 132 | new_game_flag = 0; 133 | memset(menu_pal, 0, 768); 134 | mod_fade_direction = 0; 135 | } else if (key_pressed(1) == 0) 136 | esc_pressed = 0; 137 | 138 | update_player_actions(); 139 | for (c1 = 0; c1 < JNB_MAX_PLAYERS; c1++) { 140 | if (end_loop_flag == 1 && new_game_flag == 1) { 141 | if ((player[c1].x >> 16) > (165 + c1 * 2)) { 142 | if (player[c1].x_add < 0) 143 | player[c1].x_add += 16384; 144 | else 145 | player[c1].x_add += 12288; 146 | if (player[c1].x_add > 98304L) 147 | player[c1].x_add = 98304L; 148 | player[c1].direction = 0; 149 | if (player[c1].anim == 0) { 150 | player[c1].anim = 1; 151 | player[c1].frame = 0; 152 | player[c1].frame_tick = 0; 153 | player[c1].image = player_anims[player[c1].anim].frame[player[c1].frame].image + player[c1].direction * 9; 154 | } 155 | player[c1].enabled = 1; 156 | } 157 | if (!player[c1].action_up) { 158 | if (player[c1].y_add < 0) { 159 | player[c1].y_add += 32768; 160 | if (player[c1].y_add > 0) 161 | player[c1].y_add = 0; 162 | } 163 | } 164 | player[c1].y_add += 12288; 165 | if (player[c1].y_add > 36864 && player[c1].anim != 3) { 166 | player[c1].anim = 3; 167 | player[c1].frame = 0; 168 | player[c1].frame_tick = 0; 169 | player[c1].image = player_anims[player[c1].anim].frame[player[c1].frame].image + player[c1].direction * 9; 170 | } 171 | player[c1].y += player[c1].y_add; 172 | if ((player[c1].x >> 16) <= (165 + c1 * 2) || (player[c1].x >> 16) >= (208 + c1 * 2)) { 173 | if ((player[c1].y >> 16) > (160 + c1 * 2)) { 174 | player[c1].y = (160L + c1 * 2) << 16; 175 | player[c1].y_add = 0; 176 | if (player[c1].anim != 0 && player[c1].anim != 1) { 177 | player[c1].anim = 0; 178 | player[c1].frame = 0; 179 | player[c1].frame_tick = 0; 180 | player[c1].image = player_anims[player[c1].anim].frame[player[c1].frame].image + player[c1].direction * 9; 181 | } 182 | } 183 | } else { 184 | if ((player[c1].y >> 16) > (138 + c1 * 2)) { 185 | player[c1].y = (138L + c1 * 2) << 16; 186 | player[c1].y_add = 0; 187 | if (player[c1].anim != 0 && player[c1].anim != 1) { 188 | player[c1].anim = 0; 189 | player[c1].frame = 0; 190 | player[c1].frame_tick = 0; 191 | player[c1].image = player_anims[player[c1].anim].frame[player[c1].frame].image + player[c1].direction * 9; 192 | } 193 | if (!player[c1].action_up) 194 | player[c1].jump_ready = 1; 195 | } 196 | } 197 | player[c1].x += player[c1].x_add; 198 | if ((player[c1].y >> 16) > (138 + c1 * 2)) { 199 | if ((player[c1].x >> 16) > (165 + c1 * 2) && (player[c1].x >> 16) < (190 + c1 * 2)) { 200 | player[c1].x = (165L + c1 * 2) << 16; 201 | player[c1].x_add = 0; 202 | } 203 | if ((player[c1].x >> 16) > (190 + c1 * 2) && (player[c1].x >> 16) < (208 + c1 * 2)) { 204 | player[c1].x = (208L + c1 * 2) << 16; 205 | player[c1].x_add = 0; 206 | } 207 | } 208 | } else { 209 | if (player[c1].action_left && player[c1].action_right) { 210 | if (player[c1].direction == 1) { 211 | if ((player[c1].x >> 16) <= (165 + c1 * 2) || (player[c1].x >> 16) >= (208 + c1 * 2)) { 212 | if (player[c1].x_add > 0) { 213 | player[c1].x_add -= 16384; 214 | if ((player[c1].y >> 16) >= (160 + c1 * 2)) 215 | add_object(OBJ_SMOKE, (player[c1].x >> 16) + 2 + rnd(9), (player[c1].y >> 16) + 13 + rnd(5), 0, -16384 - rnd(8192), OBJ_ANIM_SMOKE, 0); 216 | } else 217 | player[c1].x_add -= 12288; 218 | } 219 | if ((player[c1].x >> 16) > (165 + c1 * 2) && (player[c1].x >> 16) < (208 + c1 * 2)) { 220 | if (player[c1].x_add > 0) { 221 | player[c1].x_add -= 16384; 222 | if ((player[c1].y >> 16) >= (138 + c1 * 2)) 223 | add_object(OBJ_SMOKE, (player[c1].x >> 16) + 2 + rnd(9), (player[c1].y >> 16) + 13 + rnd(5), 0, -16384 - rnd(8192), OBJ_ANIM_SMOKE, 0); 224 | } else 225 | player[c1].x_add -= 12288; 226 | } 227 | if (player[c1].x_add < -98304L) 228 | player[c1].x_add = -98304L; 229 | player[c1].direction = 1; 230 | if (player[c1].anim == 0) { 231 | player[c1].anim = 1; 232 | player[c1].frame = 0; 233 | player[c1].frame_tick = 0; 234 | player[c1].image = player_anims[player[c1].anim].frame[player[c1].frame].image + player[c1].direction * 9; 235 | } 236 | } else { 237 | if ((player[c1].x >> 16) <= (165 + c1 * 2) || (player[c1].x >> 16) >= (208 + c1 * 2)) { 238 | if (player[c1].x_add < 0) { 239 | player[c1].x_add += 16384; 240 | if ((player[c1].y >> 16) >= (160 + c1 * 2)) 241 | add_object(OBJ_SMOKE, (player[c1].x >> 16) + 2 + rnd(9), (player[c1].y >> 16) + 13 + rnd(5), 0, -16384 - rnd(8192), OBJ_ANIM_SMOKE, 0); 242 | } else 243 | player[c1].x_add += 12288; 244 | } 245 | if ((player[c1].x >> 16) > (165 + c1 * 2) && (player[c1].x >> 16) < (208 + c1 * 2)) { 246 | if (player[c1].x_add < 0) { 247 | player[c1].x_add += 16384; 248 | if ((player[c1].y >> 16) >= (138 + c1 * 2)) 249 | add_object(OBJ_SMOKE, (player[c1].x >> 16) + 2 + rnd(9), (player[c1].y >> 16) + 13 + rnd(5), 0, -16384 - rnd(8192), OBJ_ANIM_SMOKE, 0); 250 | } else 251 | player[c1].x_add += 12288; 252 | } 253 | if (player[c1].x_add > 98304L) 254 | player[c1].x_add = 98304L; 255 | player[c1].direction = 0; 256 | if (player[c1].anim == 0) { 257 | player[c1].anim = 1; 258 | player[c1].frame = 0; 259 | player[c1].frame_tick = 0; 260 | player[c1].image = player_anims[player[c1].anim].frame[player[c1].frame].image + player[c1].direction * 9; 261 | } 262 | } 263 | } else if (player[c1].action_left) { 264 | if ((player[c1].x >> 16) <= (165 + c1 * 2) || (player[c1].x >> 16) >= (208 + c1 * 2)) { 265 | if (player[c1].x_add > 0) { 266 | player[c1].x_add -= 16384; 267 | if ((player[c1].y >> 16) >= (160 + c1 * 2)) 268 | add_object(OBJ_SMOKE, (player[c1].x >> 16) + 2 + rnd(9), (player[c1].y >> 16) + 13 + rnd(5), 0, -16384 - rnd(8192), OBJ_ANIM_SMOKE, 0); 269 | } else 270 | player[c1].x_add -= 12288; 271 | } 272 | if ((player[c1].x >> 16) > (165 + c1 * 2) && (player[c1].x >> 16) < (208 + c1 * 2)) { 273 | if (player[c1].x_add > 0) { 274 | player[c1].x_add -= 16384; 275 | if ((player[c1].y >> 16) >= (138 + c1 * 2)) 276 | add_object(OBJ_SMOKE, (player[c1].x >> 16) + 2 + rnd(9), (player[c1].y >> 16) + 13 + rnd(5), 0, -16384 - rnd(8192), OBJ_ANIM_SMOKE, 0); 277 | } else 278 | player[c1].x_add -= 12288; 279 | } 280 | if (player[c1].x_add < -98304L) 281 | player[c1].x_add = -98304L; 282 | player[c1].direction = 1; 283 | if (player[c1].anim == 0) { 284 | player[c1].anim = 1; 285 | player[c1].frame = 0; 286 | player[c1].frame_tick = 0; 287 | player[c1].image = player_anims[player[c1].anim].frame[player[c1].frame].image + player[c1].direction * 9; 288 | } 289 | } else if (player[c1].action_right) { 290 | if ((player[c1].x >> 16) <= (165 + c1 * 2) || (player[c1].x >> 16) >= (208 + c1 * 2)) { 291 | if (player[c1].x_add < 0) { 292 | player[c1].x_add += 16384; 293 | if ((player[c1].y >> 16) >= (160 + c1 * 2)) 294 | add_object(OBJ_SMOKE, (player[c1].x >> 16) + 2 + rnd(9), (player[c1].y >> 16) + 13 + rnd(5), 0, -16384 - rnd(8192), OBJ_ANIM_SMOKE, 0); 295 | } else 296 | player[c1].x_add += 12288; 297 | } 298 | if ((player[c1].x >> 16) > (165 + c1 * 2) && (player[c1].x >> 16) < (208 + c1 * 2)) { 299 | if (player[c1].x_add < 0) { 300 | player[c1].x_add += 16384; 301 | if ((player[c1].y >> 16) >= (138 + c1 * 2)) 302 | add_object(OBJ_SMOKE, (player[c1].x >> 16) + 2 + rnd(9), (player[c1].y >> 16) + 13 + rnd(5), 0, -16384 - rnd(8192), OBJ_ANIM_SMOKE, 0); 303 | } else 304 | player[c1].x_add += 12288; 305 | } 306 | if (player[c1].x_add > 98304L) 307 | player[c1].x_add = 98304L; 308 | player[c1].direction = 0; 309 | if (player[c1].anim == 0) { 310 | player[c1].anim = 1; 311 | player[c1].frame = 0; 312 | player[c1].frame_tick = 0; 313 | player[c1].image = player_anims[player[c1].anim].frame[player[c1].frame].image + player[c1].direction * 9; 314 | } 315 | } else { 316 | if (((player[c1].x >> 16) <= (165 + c1 * 2) || (player[c1].x >> 16) >= (208 + c1 * 2)) && (player[c1].y >> 16) >= (160 + c1 * 2)) { 317 | if (player[c1].x_add < 0) { 318 | player[c1].x_add += 16384; 319 | if (player[c1].x_add > 0) 320 | player[c1].x_add = 0; 321 | add_object(OBJ_SMOKE, (player[c1].x >> 16) + 2 + rnd(9), (player[c1].y >> 16) + 13 + rnd(5), 0, -16384 - rnd(8192), OBJ_ANIM_SMOKE, 0); 322 | } else if (player[c1].x_add > 0) { 323 | player[c1].x_add -= 16384; 324 | if (player[c1].x_add < 0) 325 | player[c1].x_add = 0; 326 | add_object(OBJ_SMOKE, (player[c1].x >> 16) + 2 + rnd(9), (player[c1].y >> 16) + 13 + rnd(5), 0, -16384 - rnd(8192), OBJ_ANIM_SMOKE, 0); 327 | } 328 | } 329 | if ((((player[c1].x >> 16) > (165 + c1 * 2) && (player[c1].x >> 16) < (208 + c1 * 2)) && (player[c1].y >> 16) >= (138 + c1 * 2))) { 330 | if (player[c1].x_add < 0) { 331 | player[c1].x_add += 16384; 332 | if (player[c1].x_add > 0) 333 | player[c1].x_add = 0; 334 | add_object(OBJ_SMOKE, (player[c1].x >> 16) + 2 + rnd(9), (player[c1].y >> 16) + 13 + rnd(5), 0, -16384 - rnd(8192), OBJ_ANIM_SMOKE, 0); 335 | } else if (player[c1].x_add > 0) { 336 | player[c1].x_add -= 16384; 337 | if (player[c1].x_add < 0) 338 | player[c1].x_add = 0; 339 | add_object(OBJ_SMOKE, (player[c1].x >> 16) + 2 + rnd(9), (player[c1].y >> 16) + 13 + rnd(5), 0, -16384 - rnd(8192), OBJ_ANIM_SMOKE, 0); 340 | } 341 | } 342 | if (player[c1].anim == 1) { 343 | player[c1].anim = 0; 344 | player[c1].frame = 0; 345 | player[c1].frame_tick = 0; 346 | player[c1].image = player_anims[player[c1].anim].frame[player[c1].frame].image + player[c1].direction * 9; 347 | } 348 | } 349 | if ((player[c1].jump_ready == 1) && player[c1].action_up) { 350 | if ((player[c1].x >> 16) <= (165 + c1 * 2) || (player[c1].x >> 16) >= (208 + c1 * 2)) { 351 | if ((player[c1].y >> 16) >= (160 + c1 * 2)) { 352 | player[c1].y_add = -280000L; 353 | player[c1].anim = 2; 354 | player[c1].frame = 0; 355 | player[c1].frame_tick = 0; 356 | player[c1].image = player_anims[player[c1].anim].frame[player[c1].frame].image + player[c1].direction * 9; 357 | player[c1].jump_ready = 0; 358 | dj_play_sfx(SFX_JUMP, (unsigned short)(SFX_JUMP_FREQ + rnd(2000) - 1000), 64, -1); 359 | } 360 | } else { 361 | if ((player[c1].y >> 16) >= (138 + c1 * 2)) { 362 | player[c1].y_add = -280000L; 363 | player[c1].anim = 2; 364 | player[c1].frame = 0; 365 | player[c1].frame_tick = 0; 366 | player[c1].image = player_anims[player[c1].anim].frame[player[c1].frame].image + player[c1].direction * 9; 367 | player[c1].jump_ready = 0; 368 | dj_play_sfx(SFX_JUMP, (unsigned short)(SFX_JUMP_FREQ + rnd(2000) - 1000), 64, -1); 369 | } 370 | } 371 | } 372 | if (!player[c1].action_up) { 373 | if (player[c1].y_add < 0) { 374 | player[c1].y_add += 32768; 375 | if (player[c1].y_add > 0) 376 | player[c1].y_add = 0; 377 | } 378 | } 379 | if (!player[c1].action_up) 380 | player[c1].jump_ready = 1; 381 | player[c1].y_add += 12288; 382 | if (player[c1].y_add > 36864 && player[c1].anim != 3) { 383 | player[c1].anim = 3; 384 | player[c1].frame = 0; 385 | player[c1].frame_tick = 0; 386 | player[c1].image = player_anims[player[c1].anim].frame[player[c1].frame].image + player[c1].direction * 9; 387 | } 388 | player[c1].y += player[c1].y_add; 389 | if ((player[c1].x >> 16) <= (165 + c1 * 2) || (player[c1].x >> 16) >= (208 + c1 * 2)) { 390 | if ((player[c1].y >> 16) > (160 + c1 * 2)) { 391 | player[c1].y = (160L + c1 * 2) << 16; 392 | player[c1].y_add = 0; 393 | if (player[c1].anim != 0 && player[c1].anim != 1) { 394 | player[c1].anim = 0; 395 | player[c1].frame = 0; 396 | player[c1].frame_tick = 0; 397 | player[c1].image = player_anims[player[c1].anim].frame[player[c1].frame].image + player[c1].direction * 9; 398 | } 399 | } 400 | } else { 401 | if ((player[c1].y >> 16) > (138 + c1 * 2)) { 402 | player[c1].y = (138L + c1 * 2) << 16; 403 | player[c1].y_add = 0; 404 | if (player[c1].anim != 0 && player[c1].anim != 1) { 405 | player[c1].anim = 0; 406 | player[c1].frame = 0; 407 | player[c1].frame_tick = 0; 408 | player[c1].image = player_anims[player[c1].anim].frame[player[c1].frame].image + player[c1].direction * 9; 409 | } 410 | } 411 | } 412 | player[c1].x += player[c1].x_add; 413 | if ((player[c1].x >> 16) < 0) { 414 | player[c1].x = 0; 415 | player[c1].x_add = 0; 416 | } 417 | if ((player[c1].x >> 16) > JNB_WIDTH) { 418 | end_loop_flag = 1; 419 | new_game_flag = 1; 420 | memset(menu_pal, 0, 768); 421 | mod_fade_direction = 0; 422 | } 423 | if ((player[c1].y >> 16) > (138 + c1 * 2)) { 424 | if ((player[c1].x >> 16) > (165 + c1 * 2) && (player[c1].x >> 16) < (190 + c1 * 2)) { 425 | player[c1].x = (165L + c1 * 2) << 16; 426 | player[c1].x_add = 0; 427 | } 428 | if ((player[c1].x >> 16) > (190 + c1 * 2) && (player[c1].x >> 16) < (208 + c1 * 2)) { 429 | player[c1].x = (208L + c1 * 2) << 16; 430 | player[c1].x_add = 0; 431 | } 432 | } 433 | } 434 | player[c1].frame_tick++; 435 | if (player[c1].frame_tick >= player_anims[player[c1].anim].frame[player[c1].frame].ticks) { 436 | player[c1].frame++; 437 | if (player[c1].frame >= player_anims[player[c1].anim].num_frames) 438 | player[c1].frame = player_anims[player[c1].anim].restart_frame; 439 | player[c1].frame_tick = 0; 440 | } 441 | player[c1].image = player_anims[player[c1].anim].frame[player[c1].frame].image + player[c1].direction * 9; 442 | } 443 | 444 | dj_mix(); 445 | 446 | main_info.page_info[main_info.draw_page].num_pobs = 0; 447 | 448 | for (c1 = 3; c1 >= 0; c1--) 449 | add_pob(main_info.draw_page, player[c1].x >> 16, player[c1].y >> 16, player[c1].image + c1 * 18, &rabbit_gobs); 450 | 451 | update_objects(); 452 | 453 | if (update_count == 1) { 454 | draw_begin(); 455 | draw_pobs(main_info.draw_page); 456 | draw_end(); 457 | 458 | dj_mix(); 459 | 460 | if (mod_fade_direction == 1) { 461 | if (mod_vol < 35) { 462 | mod_vol++; 463 | dj_set_mod_volume((char)mod_vol); 464 | } 465 | } else { 466 | if (mod_vol > 0) { 467 | mod_vol--; 468 | dj_set_mod_volume((char)mod_vol); 469 | } 470 | } 471 | } 472 | 473 | fade_flag = 0; 474 | for (c1 = 0; c1 < 720; c1++) { 475 | if (menu_cur_pal[c1] < menu_pal[c1]) { 476 | menu_cur_pal[c1]++; 477 | fade_flag = 1; 478 | } else if (menu_cur_pal[c1] > menu_pal[c1]) { 479 | menu_cur_pal[c1]--; 480 | fade_flag = 2; 481 | } 482 | } 483 | if (fade_flag == 0 && end_loop_flag == 1) { 484 | if (new_game_flag == 1) 485 | return 0; 486 | else 487 | return 1; 488 | } 489 | switch (fade_dir) { 490 | case 0: 491 | if (fade_count < 30) { 492 | for (c1 = 0; c1 < 48; c1++) { 493 | if (fade_pal[c1] > 0) 494 | fade_pal[c1]--; 495 | } 496 | fade_count++; 497 | } else { 498 | draw_begin(); 499 | clear_lines(0, 220, 20, 0); 500 | clear_lines(1, 220, 20, 0); 501 | 502 | cur_message++; 503 | if (cur_message >= NUM_MESSAGES) 504 | cur_message -= NUM_MESSAGES; 505 | put_text(0, 200, 220, message[cur_message], 2); 506 | put_text(1, 200, 220, message[cur_message], 2); 507 | fade_dir = 1; 508 | fade_count = 0; 509 | draw_end(); 510 | } 511 | break; 512 | case 1: 513 | if (fade_count < 100) { 514 | for (c1 = 0; c1 < 48; c1++) { 515 | if (fade_pal[c1] < menu_pal[c1 + 720]) 516 | fade_pal[c1]++; 517 | } 518 | fade_count++; 519 | } else { 520 | fade_dir = 0; 521 | fade_count = 0; 522 | } 523 | break; 524 | } 525 | 526 | for (c1 = 0; c1 < 48; c1++) { 527 | if (fade_pal[c1] > menu_pal[c1 + 720]) 528 | fade_pal[c1]--; 529 | } 530 | 531 | if (update_count == 1) { 532 | main_info.draw_page ^= 1; 533 | main_info.view_page ^= 1; 534 | 535 | flippage(main_info.view_page); 536 | 537 | wait_vrt(1); 538 | } 539 | 540 | if (fade_flag != 0) { 541 | setpalette(0, 240, menu_cur_pal); 542 | } 543 | 544 | if (update_count == 1) { 545 | setpalette(240, 16, fade_pal); 546 | 547 | dj_mix(); 548 | 549 | draw_begin(); 550 | redraw_pob_backgrounds(main_info.draw_page); 551 | draw_end(); 552 | } 553 | 554 | update_count--; 555 | } 556 | 557 | update_count = intr_sysupdate(); 558 | 559 | } 560 | 561 | return 0; 562 | 563 | } 564 | 565 | 566 | int menu_init(void) 567 | { 568 | unsigned char *handle; 569 | int c1; 570 | 571 | fillpalette(0, 0, 0); 572 | 573 | if ((handle = dat_open("menu.pcx")) == 0) { 574 | strcpy(main_info.error_str, "Error loading 'menu.pcx', aborting...\n"); 575 | return 1; 576 | } 577 | if (read_pcx(handle, background_pic, JNB_WIDTH*JNB_HEIGHT, menu_pal) != 0) { 578 | strcpy(main_info.error_str, "Error loading 'menu.pcx', aborting...\n"); 579 | return 1; 580 | } 581 | if ((handle = dat_open("menumask.pcx")) == 0) { 582 | strcpy(main_info.error_str, "Error loading 'menumask.pcx', aborting...\n"); 583 | return 1; 584 | } 585 | if (read_pcx(handle, mask_pic, JNB_WIDTH*JNB_HEIGHT, 0) != 0) { 586 | strcpy(main_info.error_str, "Error loading 'menumask.pcx', aborting...\n"); 587 | return 1; 588 | } 589 | memset(menu_cur_pal, 0, 768); 590 | 591 | /* fix dark font */ 592 | for (c1 = 0; c1 < 16; c1++) { 593 | menu_pal[(240 + c1) * 3 + 0] = c1 << 2; 594 | menu_pal[(240 + c1) * 3 + 1] = c1 << 2; 595 | menu_pal[(240 + c1) * 3 + 2] = c1 << 2; 596 | } 597 | 598 | register_background(background_pic, menu_pal); 599 | register_mask(mask_pic); 600 | 601 | for (c1 = 0; c1 < JNB_MAX_PLAYERS; c1++) { 602 | player[c1].enabled = 0; 603 | player[c1].x = (long) rnd(150) << 16; 604 | player[c1].y = (160L + c1 * 2) << 16; 605 | player[c1].x_add = 0; 606 | player[c1].y_add = 0; 607 | player[c1].direction = rnd(2); 608 | player[c1].jump_ready = 1; 609 | player[c1].anim = 0; 610 | player[c1].frame = 0; 611 | player[c1].frame_tick = 0; 612 | player[c1].image = player_anims[player[c1].anim].frame[player[c1].frame].image; 613 | } 614 | 615 | for (c1 = 0; c1 < NUM_OBJECTS; c1++) 616 | objects[c1].used = 0; 617 | 618 | main_info.page_info[0].num_pobs = 0; 619 | main_info.page_info[1].num_pobs = 0; 620 | 621 | return 0; 622 | 623 | } 624 | --------------------------------------------------------------------------------