Skip to content

Commit

Permalink
Added -noflies option (doesn't affect butterflies).
Browse files Browse the repository at this point in the history
Added framework for networking (Thanks to Ryan C. Gordon).
Still need to implement the network functions itself.
  • Loading branch information
Florian Schulze committed Aug 16, 2002
1 parent 00e42c6 commit fd63c5e
Show file tree
Hide file tree
Showing 9 changed files with 1,248 additions and 349 deletions.
3 changes: 3 additions & 0 deletions AUTHORS
Expand Up @@ -40,3 +40,6 @@ Ben Hines <bhines@alumni.ucsd.edu>

David Garc�a Rodr�guez <bkron@hotmail.com>
Level making tutorial.

Ryan C. Gordon <icculus@clutteredmind.org>
Made networking possible again.
4 changes: 2 additions & 2 deletions dj.h
Expand Up @@ -127,14 +127,14 @@ extern char dj_get_sfx_settings(unsigned char sfx_num, sfx_data *data);
extern char dj_set_sfx_settings(unsigned char sfx_num, sfx_data *data);
extern void dj_set_sfx_channel_volume(char channel_num, char volume);
extern void dj_stop_sfx_channel(char channel_num);
extern char dj_load_sfx(FILE *file_handle, char *filename, int file_length, char sfx_type, unsigned char sfx_num);
extern char dj_load_sfx(unsigned char *file_handle, char *filename, int file_length, char sfx_type, unsigned char sfx_num);
extern void dj_free_sfx(unsigned char sfx_num);

extern char dj_ready_mod(char mod_num);
extern char dj_start_mod(void);
extern void dj_stop_mod(void);
extern void dj_set_mod_volume(char volume);
extern char dj_get_mod_volume(void);
extern char dj_load_mod(FILE *file_handle, char *filename, char mod_num);
extern char dj_load_mod(unsigned char *file_handle, char *filename, char mod_num);
extern void dj_free_mod(char mod_num);

15 changes: 7 additions & 8 deletions fireworks.c
Expand Up @@ -33,7 +33,7 @@ extern unsigned int ban_map[17][22];

void fireworks(void)
{
FILE *handle;
char *handle;
int c1, c2;
int s1, s2, s3;
char pal[768];
Expand All @@ -57,10 +57,9 @@ void fireworks(void)
strcpy(main_info.error_str, "Error loading 'level.pcx', aborting...\n");
return;
}
read_pcx(handle, mask_pic, 102400, pal);
fclose(handle);
read_pcx(handle, mask_pic, JNB_WIDTH*JNB_HEIGHT, pal);

memset(mask_pic, 0, 102400);
memset(mask_pic, 0, JNB_WIDTH*JNB_HEIGHT);
register_mask(mask_pic);

recalculate_gob(&rabbit_gobs, pal);
Expand All @@ -72,7 +71,7 @@ void fireworks(void)

draw_begin();

for (c2 = 193; c2 < 256; c2++) {
for (c2 = JNB_HEIGHT - 63; c2 < JNB_HEIGHT; c2++) {
clear_lines(0, c2, 1, get_color((c2 - 192) >> 2, pal));
clear_lines(1, c2, 1, get_color((c2 - 192) >> 2, pal));
}
Expand Down Expand Up @@ -102,8 +101,8 @@ void fireworks(void)

draw_begin();
for (c1 = 0; c1 < 300; c1++) {
s1 = rnd(400);
s2 = rnd(256);
s1 = rnd(JNB_WIDTH);
s2 = rnd(JNB_HEIGHT);
s3 = 30 - rnd(7);
stars[c1].x = stars[c1].old_x = (s1 << 16);
stars[c1].y = stars[c1].old_y = (s2 << 16);
Expand Down Expand Up @@ -176,7 +175,7 @@ void fireworks(void)
}
rabbits[c1].x += rabbits[c1].x_add;
rabbits[c1].y += rabbits[c1].y_add;
if ((rabbits[c1].x >> 16) < 16 || (rabbits[c1].x >> 16) > 400 || (rabbits[c1].y >> 16) > 256) {
if ((rabbits[c1].x >> 16) < 16 || (rabbits[c1].x >> 16) > JNB_WIDTH || (rabbits[c1].y >> 16) > JNB_HEIGHT) {
rabbits[c1].used = 0;
continue;
}
Expand Down
37 changes: 30 additions & 7 deletions globals.h
Expand Up @@ -30,6 +30,10 @@
#ifndef __GLOBALS_H
#define __GLOBALS_H

#ifdef __cplusplus
extern "C" {
#endif

#include "config.h"

#include <assert.h>
Expand All @@ -56,19 +60,34 @@
# include <sys/stat.h>
# include <io.h>
# include <SDL.h>
# include <SDL_mixer.h>
# if USE_SDL_MIXER
# include <SDL_mixer.h>
# endif
#else
# ifdef USE_SDL
# include <sys/stat.h>
# include <SDL/SDL.h>
# include <SDL/SDL_mixer.h>
# if USE_SDL_MIXER
# include <SDL/SDL_mixer.h>
# endif
# endif
#endif

#define JNB_VERSION "1.35"
#define JNB_MAX_PLAYERS 4

#define JNB_INETPORT 11111

extern int client_player_num;
void tellServerPlayerMoved(int playerid, int movement_type, int newval);
#define MOVEMENT_LEFT 1
#define MOVEMENT_RIGHT 2
#define MOVEMENT_UP 3

#define JNB_VERSION "1.39"

#define JNB_WIDTH 400
#define JNB_HEIGHT 256

extern int screen_width;
extern int screen_height;
extern int screen_pitch;
Expand Down Expand Up @@ -187,7 +206,7 @@ typedef struct {
int action_left,action_up,action_right;
int enabled, dead_flag;
int bumps;
int bumped[4];
int bumped[JNB_MAX_PLAYERS];
int x, y;
int x_add, y_add;
int direction, jump_ready, jump_abort, in_water;
Expand Down Expand Up @@ -270,7 +289,7 @@ int init_program(int argc, char *argv[], char *pal);
void deinit_program(void);
unsigned short rnd(unsigned short max);
int read_level(void);
FILE *dat_open(char *file_name, char *dat_name, char *mode);
unsigned char *dat_open(char *file_name, char *dat_name, char *mode);
int dat_filelen(char *file_name, char *dat_name);
void write_calib_data(void);

Expand Down Expand Up @@ -317,9 +336,9 @@ 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, void *buffer, int buf_len, char *pal);
int read_pcx(unsigned char * 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);
int register_gob(unsigned char *handle, gob_t *gob, int len);
void recalculate_gob(gob_t *gob, char pal[768]);
void register_mask(void *pixels);

Expand All @@ -345,4 +364,8 @@ int key_pressed(int key);

#endif

#ifdef __cplusplus
}
#endif

#endif

0 comments on commit fd63c5e

Please sign in to comment.