Commit c99c70d3 authored by Florian Schulze's avatar Florian Schulze

Implemented -scaleup and -nosound options. Some fixes for first release.

parent 166b1261
This diff is collapsed.
22 Feb 2002 - 1.0
- working sound
- new scaling graphics mode
- cleaned up code
===========================================================================
This is the changelog of the linux version from which this port is derived.
25 Feb 2001 - 0.69
initial linux port, worked fine with freebsd too (chuck mason)
......
http://jumpbump.mine.nu/
http://www.icculus.org/jumpnbump/
http://freshmeat.net/projects/jumpnbump
http://winbe.linuxberg.com/x11html/preview/168332.html
http://linuxapps.com/?page=application&database=current&id=3594
......
we need a -nosound parameter because:
From: "Jo eL" <jjshoe@hotmail.com>
Date: Sun, 04 Mar 2001 15:28:33 -0000
make a version which doesnt require sound
wont run for me
the network code is working (testing)
/join #keen on irc.linux.com
March 11 2001 (done by LongIslandMan, http://jonatkins.org)
/*
* config.h
* Copyright (C) 1998 Brainchild Design - http://brainchilddesign.com/
*
* Copyright (C) 2001 tarzeau@space.ch
*
* Copyright (C) 2002 Florian Schulze - crow@icculus.org
*
* Portions of this code are from the MPEG software simulation group
* idct implementation. This code will be replaced with a new
* implementation soon.
*
* This file is part of Jump'n'Bump.
*
* Jump'n'Bump is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* Jump'n'Bump is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __CONFIG_H
#define __CONFIG_H
......
/*
* dj.h
* Copyright (C) 1998 Brainchild Design - http://brainchilddesign.com/
*
* Copyright (C) 2001 tarzeau@space.ch
*
* Copyright (C) 2002 Florian Schulze - crow@icculus.org
*
* Portions of this code are from the MPEG software simulation group
* idct implementation. This code will be replaced with a new
* implementation soon.
*
* This file is part of Jump'n'Bump.
*
* Jump'n'Bump is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* Jump'n'Bump is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
......
/*
* gfx.h
* Copyright (C) 1998 Brainchild Design - http://brainchilddesign.com/
*
* Copyright (C) 2001 tarzeau@space.ch
*
* Copyright (C) 2002 Florian Schulze - crow@icculus.org
*
* Portions of this code are from the MPEG software simulation group
* idct implementation. This code will be replaced with a new
* implementation soon.
*
* This file is part of Jump'n'Bump.
*
* Jump'n'Bump is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* Jump'n'Bump is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "globals.h"
......
/*
* input.h
* Copyright (C) 1998 Brainchild Design - http://brainchilddesign.com/
*
* Copyright (C) 2001 tarzeau@space.ch
*
* Copyright (C) 2002 Florian Schulze - crow@icculus.org
*
* Portions of this code are from the MPEG software simulation group
* idct implementation. This code will be replaced with a new
* implementation soon.
*
* This file is part of Jump'n'Bump.
*
* Jump'n'Bump is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* Jump'n'Bump is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "globals.h"
static int num_mouse_buttons;
......
/*
* interrpt.h
* Copyright (C) 1998 Brainchild Design - http://brainchilddesign.com/
*
* Copyright (C) 2001 tarzeau@space.ch
*
* Copyright (C) 2002 Florian Schulze - crow@icculus.org
*
* Portions of this code are from the MPEG software simulation group
* idct implementation. This code will be replaced with a new
* implementation soon.
*
* This file is part of Jump'n'Bump.
*
* Jump'n'Bump is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* Jump'n'Bump is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "globals.h"
......
/*
* fireworks.c
* Copyright (C) 1998 Brainchild Design - http://brainchilddesign.com/
*
* Copyright (C) 2001 tarzeau@space.ch
*
* Copyright (C) 2002 Florian Schulze - crow@icculus.org
*
* Portions of this code are from the MPEG software simulation group
* idct implementation. This code will be replaced with a new
* implementation soon.
*
* This file is part of Jump'n'Bump.
*
* Jump'n'Bump is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* Jump'n'Bump is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "globals.h"
extern unsigned int ban_map[17][22];
......@@ -19,7 +48,7 @@ void fireworks(void)
int x, y;
int old_x, old_y;
int col;
pixel_t back[2];
int back[2];
} stars[300];
register_background(NULL, NULL);
......
/*
* globals.h
* Copyright (C) 1998 Brainchild Design - http://brainchilddesign.com/
*
* Copyright (C) 2001 tarzeau@space.ch
*
* Copyright (C) 2002 Florian Schulze - crow@icculus.org
*
* Portions of this code are from the MPEG software simulation group
* idct implementation. This code will be replaced with a new
* implementation soon.
*
* This file is part of Jump'n'Bump.
*
* Jump'n'Bump is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* Jump'n'Bump is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __GLOBALS_H
#define __GLOBALS_H
......@@ -22,6 +51,8 @@
#endif
#ifdef _MSC_VER
# define WIN32_LEAN_AND_MEAN
# include <windows.h>
# include <sys/stat.h>
# include <io.h>
# include <SDL.h>
......@@ -36,24 +67,11 @@
#define JNB_WIDTH 400
#define JNB_HEIGHT 256
#ifndef SCALE_UP
#define SCALE_UP2
#endif
#if (defined(SCALE_UP) || defined(SCALE_UP2))
#define JNB_BPP 16
#define JNB_BYTESPP 2
#define JNB_SURFACE_WIDTH (JNB_WIDTH*2)
#define JNB_SURFACE_HEIGHT (JNB_HEIGHT*2)
typedef unsigned short pixel_t;
#else
#define JNB_BPP 8
#define JNB_BYTESPP 1
#define JNB_SURFACE_WIDTH JNB_WIDTH
#define JNB_SURFACE_HEIGHT JNB_HEIGHT
typedef unsigned char pixel_t;
#endif
extern int screen_width;
extern int screen_height;
extern int screen_pitch;
extern int scale_up;
extern int bytes_per_pixel;
#ifndef USE_SDL
#define KEY_PL1_LEFT 0xcb
......@@ -132,8 +150,8 @@ typedef struct {
int *height;
int *hs_x;
int *hs_y;
pixel_t **data;
unsigned char **orig_data;
void **data;
void **orig_data;
} gob_t;
struct {
......@@ -150,7 +168,7 @@ struct {
int back_buf_ofs;
} pobs[NUM_POBS];
} page_info[2];
pixel_t pob_backbuf[2][JNB_SURFACE_WIDTH*JNB_SURFACE_HEIGHT];
void *pob_backbuf[2];
} main_info;
struct {
......@@ -253,6 +271,7 @@ void menu_deinit(void);
/* gfx.c */
void set_scaling(int scale);
void open_screen(void);
void wait_vrt(int mix);
void draw_begin(void);
......@@ -260,30 +279,30 @@ void draw_end(void);
void flippage(int page);
void draw_begin(void);
void draw_end(void);
void clear_lines(int page, int y, int count, pixel_t color);
pixel_t get_color(int color, char pal[768]);
pixel_t get_pixel(int page, int x, int y);
void set_pixel(int page, int x, int y, pixel_t color);
void clear_lines(int page, int y, int count, int color);
int get_color(int color, char pal[768]);
int get_pixel(int page, int x, int y);
void set_pixel(int page, int x, int y, int color);
void setpalette(int index, int count, char *palette);
void fillpalette(int red, int green, int blue);
#ifdef DOS
void get_block(char page, short x, short y, short width, short height, char *buffer);
void put_block(char page, short x, short y, short width, short height, char *buffer);
#else
void get_block(int page, int x, int y, int width, int height, pixel_t *buffer);
void put_block(int page, int x, int y, int width, int height, pixel_t *buffer);
void get_block(int page, int x, int y, int width, int height, void *buffer);
void put_block(int page, int x, int y, int width, int height, void *buffer);
#endif
void put_text(int page, int x, int y, char *text, int align);
void put_pob(int page, int x, int y, int image, gob_t *gob, int mask, unsigned char *mask_pic);
void put_pob(int page, int x, int y, int image, gob_t *gob, int mask, void *mask_pic);
int pob_width(int image, gob_t *gob);
int pob_height(int image, gob_t *gob);
int pob_hs_x(int image, gob_t *gob);
int pob_hs_y(int image, gob_t *gob);
int read_pcx(FILE * handle, char *buffer, int buf_len, char *pal);
int read_pcx(FILE * handle, void *buffer, int buf_len, char *pal);
void register_background(char *pixels, char pal[768]);
int register_gob(FILE *handle, gob_t *gob, int len);
void recalculate_gob(gob_t *gob, char pal[768]);
void register_mask(char *pixels);
void register_mask(void *pixels);
/* gfx.c */
......
/*
* main.c
* Copyright (C) 1998 Brainchild Design - http://brainchilddesign.com/
*
* Copyright (C) 2001 tarzeau@space.ch
*
* Copyright (C) 2002 Florian Schulze - crow@icculus.org
*
* Portions of this code are from the MPEG software simulation group
* idct implementation. This code will be replaced with a new
* implementation soon.
*
* This file is part of Jump'n'Bump.
*
* Jump'n'Bump is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* Jump'n'Bump is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "globals.h"
#ifndef M_PI
......@@ -155,7 +184,7 @@ struct {
struct {
int x, y;
int old_x, old_y;
pixel_t back[2];
int back[2];
int back_defined[2];
} flies[NUM_FLIES];
......@@ -324,7 +353,8 @@ int main(int argc, char *argv[])
pal[454] = 8;
pal[455] = 8;
}
//register_background(background_pic, pal);
register_background(background_pic, pal);
recalculate_gob(&object_gobs, pal);
last_keys[0] = 0;
}
......@@ -1602,12 +1632,11 @@ void draw_pobs(int page)
for (c1 = main_info.page_info[page].num_pobs - 1; c1 >= 0; c1--) {
main_info.page_info[page].pobs[c1].back_buf_ofs = back_buf_ofs;
get_block(page, main_info.page_info[page].pobs[c1].x - pob_hs_x(main_info.page_info[page].pobs[c1].image, main_info.page_info[page].pobs[c1].pob_data), main_info.page_info[page].pobs[c1].y - pob_hs_y(main_info.page_info[page].pobs[c1].image, main_info.page_info[page].pobs[c1].pob_data), pob_width(main_info.page_info[page].pobs[c1].image, main_info.page_info[page].pobs[c1].pob_data), pob_height(main_info.page_info[page].pobs[c1].image, main_info.page_info[page].pobs[c1].pob_data), &main_info.pob_backbuf[page][back_buf_ofs]);
#ifdef SCALE_UP2
back_buf_ofs += pob_width(main_info.page_info[page].pobs[c1].image, main_info.page_info[page].pobs[c1].pob_data) * pob_height(main_info.page_info[page].pobs[c1].image, main_info.page_info[page].pobs[c1].pob_data) * 4 * JNB_BYTESPP;
#else
back_buf_ofs += pob_width(main_info.page_info[page].pobs[c1].image, main_info.page_info[page].pobs[c1].pob_data) * pob_height(main_info.page_info[page].pobs[c1].image, main_info.page_info[page].pobs[c1].pob_data);
#endif
get_block(page, main_info.page_info[page].pobs[c1].x - pob_hs_x(main_info.page_info[page].pobs[c1].image, main_info.page_info[page].pobs[c1].pob_data), main_info.page_info[page].pobs[c1].y - pob_hs_y(main_info.page_info[page].pobs[c1].image, main_info.page_info[page].pobs[c1].pob_data), pob_width(main_info.page_info[page].pobs[c1].image, main_info.page_info[page].pobs[c1].pob_data), pob_height(main_info.page_info[page].pobs[c1].image, main_info.page_info[page].pobs[c1].pob_data), (unsigned char *)main_info.pob_backbuf[page] + back_buf_ofs);
if (scale_up)
back_buf_ofs += pob_width(main_info.page_info[page].pobs[c1].image, main_info.page_info[page].pobs[c1].pob_data) * pob_height(main_info.page_info[page].pobs[c1].image, main_info.page_info[page].pobs[c1].pob_data) * 4 * bytes_per_pixel;
else
back_buf_ofs += pob_width(main_info.page_info[page].pobs[c1].image, main_info.page_info[page].pobs[c1].pob_data) * pob_height(main_info.page_info[page].pobs[c1].image, main_info.page_info[page].pobs[c1].pob_data) * bytes_per_pixel;
put_pob(page, main_info.page_info[page].pobs[c1].x, main_info.page_info[page].pobs[c1].y, main_info.page_info[page].pobs[c1].image, main_info.page_info[page].pobs[c1].pob_data, 1, mask_pic);
}
......@@ -1630,7 +1659,7 @@ void redraw_pob_backgrounds(int page)
int c1;
for (c1 = 0; c1 < main_info.page_info[page].num_pobs; c1++)
put_block(page, main_info.page_info[page].pobs[c1].x - pob_hs_x(main_info.page_info[page].pobs[c1].image, main_info.page_info[page].pobs[c1].pob_data), main_info.page_info[page].pobs[c1].y - pob_hs_y(main_info.page_info[page].pobs[c1].image, main_info.page_info[page].pobs[c1].pob_data), pob_width(main_info.page_info[page].pobs[c1].image, main_info.page_info[page].pobs[c1].pob_data), pob_height(main_info.page_info[page].pobs[c1].image, main_info.page_info[page].pobs[c1].pob_data), &main_info.pob_backbuf[page][main_info.page_info[page].pobs[c1].back_buf_ofs]);
put_block(page, main_info.page_info[page].pobs[c1].x - pob_hs_x(main_info.page_info[page].pobs[c1].image, main_info.page_info[page].pobs[c1].pob_data), main_info.page_info[page].pobs[c1].y - pob_hs_y(main_info.page_info[page].pobs[c1].image, main_info.page_info[page].pobs[c1].pob_data), pob_width(main_info.page_info[page].pobs[c1].image, main_info.page_info[page].pobs[c1].pob_data), pob_height(main_info.page_info[page].pobs[c1].image, main_info.page_info[page].pobs[c1].pob_data), (unsigned char *)main_info.pob_backbuf[page] + main_info.page_info[page].pobs[c1].back_buf_ofs);
}
......@@ -1803,6 +1832,8 @@ int init_program(int argc, char *argv[], char *pal)
else if (stricmp(argv[c1], "-fullscreen") == 0)
fs_toggle();
#endif
else if (stricmp(argv[c1], "-scaleup") == 0)
set_scaling(1);
else if (stricmp(argv[c1], "-dat") == 0) {
if (c1 < (argc - 1)) {
if ((handle = fopen(argv[c1 + 1], "rb")) != NULL) {
......@@ -1821,6 +1852,9 @@ int init_program(int argc, char *argv[], char *pal)
}
}
main_info.pob_backbuf[0] = malloc(screen_pitch*screen_height*bytes_per_pixel);
main_info.pob_backbuf[1] = malloc(screen_pitch*screen_height*bytes_per_pixel);
for (c1 = 0; c1 < 7; c1++) {
player_anims[c1].num_frames = player_anim_data[c1 * 10];
player_anims[c1].restart_frame = player_anim_data[c1 * 10 + 1];
......@@ -2077,7 +2111,6 @@ int init_program(int argc, char *argv[], char *pal)
}
void deinit_program(void)
{
#ifdef DOS
......@@ -2106,6 +2139,9 @@ void deinit_program(void)
if (main_info.error_str[0] != 0) {
printf(main_info.error_str);
#ifdef _MSC_VER
MessageBox(0, main_info.error_str, "Jump'n'Bump", 0);
#endif
exit(1);
} else
exit(0);
......
/*
* menu.c
* Copyright (C) 1998 Brainchild Design - http://brainchilddesign.com/
*
* Copyright (C) 2001 tarzeau@space.ch
*
* Copyright (C) 2002 Florian Schulze - crow@icculus.org
*
* Portions of this code are from the MPEG software simulation group
* idct implementation. This code will be replaced with a new
* implementation soon.
*
* This file is part of Jump'n'Bump.
*
* Jump'n'Bump is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* Jump'n'Bump is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "globals.h"
char *menu_background;
......@@ -6,13 +35,15 @@ char menu_pal[768];
char menu_cur_pal[768];
char *message[] = {
"Jump 'n Bump",
"Jump 'n Bump 1.0",
"by Brainchild Design in 1998.",
"Code by Mattias Brynervall.",
"Graphics by Martin Magnusson",
"and Andreas Brynervall.",
"Music by Anders Nilsson.",
"Linux port by Chuck Mason.",
"New SDL port by Florian Schulze.",
"http://www.icculus.org/jumpnbump/",
"Visit our homepage at:",
"http://www.algonet.se/~mattiasb",
"Jump 'n Bump is e-mailware.",
......
/*
* pack.c
* Copyright (C) 1998 Brainchild Design - http://brainchilddesign.com/
*
* Copyright (C) 2001 tarzeau@space.ch
*
* Copyright (C) 2002 Florian Schulze - crow@icculus.org
*
* Portions of this code are from the MPEG software simulation group
* idct implementation. This code will be replaced with a new
* implementation soon.
*
* This file is part of Jump'n'Bump.
*
* Jump'n'Bump is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* Jump'n'Bump is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
......
/*
* unpack.c
* Copyright (C) 1998 Brainchild Design - http://brainchilddesign.com/
*
* Copyright (C) 2001 tarzeau@space.ch
*
* Copyright (C) 2002 Florian Schulze - crow@icculus.org
*
* Portions of this code are from the MPEG software simulation group
* idct implementation. This code will be replaced with a new
* implementation soon.
*
* This file is part of Jump'n'Bump.
*
* Jump'n'Bump is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* Jump'n'Bump is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
......
This port is done by Florian Schulze (crow@icculus.org).
Homepage: http://www.icculus.org/jumpnbump/
There is a new scaled up graphics mode. To use it add -scaleup to the command line.
The sound is now much better than in the old SDL versions.
Florian Schulze
\ No newline at end of file
This diff is collapsed.
/*
* input.c
* Copyright (C) 1998 Brainchild Design - http://brainchilddesign.com/
*
* Copyright (C) 2001 tarzeau@space.ch
*
* Copyright (C) 2002 Florian Schulze - crow@icculus.org
*
* Portions of this code are from the MPEG software simulation group
* idct implementation. This code will be replaced with a new
* implementation soon.
*
* This file is part of Jump'n'Bump.
*
* Jump'n'Bump is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* Jump'n'Bump is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "globals.h"
int calib_joy(int type)
......
/*
* interrpt.c
* Copyright (C) 1998 Brainchild Design - http://brainchilddesign.com/
*
* Copyright (C) 2001 tarzeau@space.ch
*
* Copyright (C) 2002 Florian Schulze - crow@icculus.org
*
* Portions of this code are from the MPEG software simulation group
* idct implementation. This code will be replaced with a new
* implementation soon.
*
* This file is part of Jump'n'Bump.
*
* Jump'n'Bump is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* Jump'n'Bump is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
......
/*
* sound.c
* Copyright (C) 1998 Brainchild Design - http://brainchilddesign.com/
*
* Copyright (C) 2001 tarzeau@space.ch
*
* Copyright (C) 2002 Florian Schulze - crow@icculus.org
*
* Portions of this code are from the MPEG software simulation group
* idct implementation. This code will be replaced with a new
* implementation soon.
*
* This file is part of Jump'n'Bump.
*
* Jump'n'Bump is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* Jump'n'Bump is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "globals.h"
#include <limits.h>
......@@ -223,11 +252,15 @@ char dj_init(void)
open_screen();
if (main_info.no_sound)
return 0;
audio_buffers = SAMPLECOUNT*audio_rate/11025;
if (Mix_OpenAudio(audio_rate, audio_format, audio_channels, audio_buffers) < 0) {
fprintf(stderr, "Couldn't open audio: %s\n", SDL_GetError());
return 0;
main_info.no_sound = 1;
return 1;
}
Mix_QuerySpec(&audio_rate, &audio_format, &audio_channels);
......@@ -245,6 +278,9 @@ char dj_init(void)
void dj_deinit(void)
{
if (main_info.no_sound)
return;
Mix_HaltMusic();
if (current_music)
Mix_FreeMusic(current_music);
......@@ -305,6 +341,9 @@ char dj_set_num_sfx_channels(char num_channels)
void dj_set_sfx_volume(char volume)
{
if (main_info.no_sound)
return;
SDL_LockAudio();
global_sfx_volume = volume*2;
SDL_UnlockAudio();
......@@ -314,6 +353,9 @@ void dj_play_sfx(unsigned char sfx_num, unsigned short freq, char volume, char p
{
int slot;
if (main_info.no_sound)
return;