From: DeaDDooMER Date: Sun, 15 Mar 2020 09:20:39 +0000 (+0300) Subject: headers describes that c-files implements X-Git-Url: http://deadsoftware.ru/gitweb?p=flatwaifu.git;a=commitdiff_plain;h=2bb81ea2565c3627c954b5c37326db89b0048472 headers describes that c-files implements --- diff --git a/src/a8.c b/src/a8.c index 2203b52..855ec1e 100644 --- a/src/a8.c +++ b/src/a8.c @@ -31,6 +31,7 @@ #include "error.h" #include "files.h" #include "sound.h" +#include "a8.h" */ /* diff --git a/src/a8.h b/src/a8.h new file mode 100644 index 0000000..b5be13c --- /dev/null +++ b/src/a8.h @@ -0,0 +1,8 @@ +#ifndef A8_H_INCLUDED +#define A8_H_INCLUDED + +int A8_start(char *nm); +int A8_nextframe (void); +void A8_close (void); + +#endif /* A8_H_INCLUDED */ diff --git a/src/anim.c b/src/anim.c index 71c4421..f68f0a2 100644 --- a/src/anim.c +++ b/src/anim.c @@ -26,6 +26,7 @@ #include //#include #include "error.h" +#include "anim.h" enum{AB_END,AB_SCREEN,AB_UPDATE}; @@ -104,4 +105,4 @@ int ANM_play(void) { if(anm->t==AB_END) return 0; return 1; } -*/ \ No newline at end of file +*/ diff --git a/src/anim.h b/src/anim.h new file mode 100644 index 0000000..110c871 --- /dev/null +++ b/src/anim.h @@ -0,0 +1,7 @@ +#ifndef ANIM_H_INCLUDED +#define ANIM_H_INCLUDED + +// void ANM_start (void *p); +// int ANM_play (void); + +#endif /* ANIM_H_INCLUDED */ diff --git a/src/bmap.c b/src/bmap.c index ccb4404..aa63cdb 100644 --- a/src/bmap.c +++ b/src/bmap.c @@ -20,6 +20,7 @@ 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +#include #include "glob.h" #include "view.h" #include "bmap.h" diff --git a/src/bmap.h b/src/bmap.h index 218c0c7..ff53c7a 100644 --- a/src/bmap.h +++ b/src/bmap.h @@ -19,16 +19,22 @@ 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -// Block map +#ifndef BMAP_H_INCLUDED +#define BMAP_H_INCLUDED + +#include "glob.h" +#include "view.h" // obj_t #define BM_WALL 1 #define BM_PLR1 2 #define BM_PLR2 4 #define BM_MONSTER 8 -void BM_clear(byte f); -void BM_mark(obj_t *o,byte f); -void BM_remapfld(void); - -extern byte bmap[FLDH/4][FLDW/4]; extern byte fld_need_remap; +extern byte bmap[FLDH/4][FLDW/4]; + +void BM_clear (byte f); +void BM_mark (obj_t *o, byte f); +void BM_remapfld (void); + +#endif /* BMAP_H_INCLUDED */ diff --git a/src/config.c b/src/config.c index 9ad78cb..0c5bc21 100644 --- a/src/config.c +++ b/src/config.c @@ -24,20 +24,19 @@ #include #include #include -#include "config.h" -//#include "vga.h" -#include "error.h" +#include +#include "map.h" #include "sound.h" -#include "files.h" +#include "music.h" #include "view.h" +#include "monster.h" #include "player.h" +#include "menu.h" +#include "files.h" +#include "render.h" +#include "error.h" #include "my.h" -#include - -extern byte _warp,fastdraw,nomon; -extern int mem_chk_sz; - enum{NONE,BYTE,WORD,DWORD,STRING,SW_ON,SW_OFF,FILES,KEY}; typedef struct{ @@ -46,13 +45,12 @@ typedef struct{ byte t,o; }cfg_t; - byte cheat=0; - byte shot_vga=0; - - char cd_path[128]=""; +char cfg_file[128]="default.cfg"; + +static char buf[256]; static cfg_t cfg[]={ {"file",NULL,NULL,FILES,0}, @@ -93,11 +91,6 @@ static cfg_t cfg[]={ {NULL,NULL,NULL,NONE,0} }; - -char cfg_file[128]="default.cfg"; - -static char buf[256]; - void CFG_args(int argc, char *argv[]) { int j; dword n; @@ -161,8 +154,7 @@ next: } } -int get_key(char *name) -{ +static int get_key (char *name) { int i; for(i=1; i #include #include "view.h" #include "dots.h" @@ -39,8 +40,6 @@ #define SP_MINT 5 #define SP_MAXT 7 -extern byte z_dot; - typedef struct{ int xv,yv; byte c,t; diff --git a/src/dots.h b/src/dots.h index 7229fff..5a8b752 100644 --- a/src/dots.h +++ b/src/dots.h @@ -19,23 +19,32 @@ 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -// Dots +#ifndef DOTS_H_INCLUDED +#define DOTS_H_INCLUDED + +#include "glob.h" +#include "view.h" // obj_t +#include // FILE #define MAXDOT 400 #pragma pack(1) -typedef struct{ +typedef struct { obj_t o; - byte c,t; -}dot_t; + byte c, t; +} dot_t; #pragma pack() extern dot_t dot[MAXDOT]; -void DOT_init(void); -void DOT_alloc(void); -void DOT_act(void); -void DOT_add(int x,int y,char xv,char yv,byte color,byte time); -void DOT_blood(int,int,int,int,int); -void DOT_spark(int,int,int,int,int); -void DOT_water(int,int,int,int,int,int); +void DOT_savegame (FILE *h); +void DOT_loadgame (FILE *h); +void DOT_init (void); +void DOT_alloc (void); +void DOT_act (void); +void DOT_add (int x, int y, char xv, char yv, byte c, byte t); +void DOT_blood (int x, int y, int xv, int yv, int n); +void DOT_spark (int x, int y, int xv, int yv, int n); +void DOT_water (int x, int y, int xv, int yv, int n, int c); + +#endif /* DOTS_H_INCLUDED */ diff --git a/src/error.c b/src/error.c index ef9c388..46e5c43 100644 --- a/src/error.c +++ b/src/error.c @@ -31,6 +31,20 @@ #include "memory.h" #include "error.h" #include "config.h" +#include "music.h" + +void logo (const char *s, ...) { + va_list ap; + int x, y; + va_start(ap, s); + vprintf(s, ap); + va_end(ap); + fflush(stdout); +} + +void logo_gas (int cur, int all) { + // stub +} static void close_all (void) { S_done(); diff --git a/src/error.h b/src/error.h index ecb2cc2..45b2975 100644 --- a/src/error.h +++ b/src/error.h @@ -19,8 +19,13 @@ 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -// Error handling +#ifndef ERROR_H_INCLUDED +#define ERROR_H_INCLUDED -void ERR_failinit(char *,...); -void ERR_fatal(char *,...); -void ERR_quit(void); +void logo (const char *s, ...); +void logo_gas (int cur, int all); +void ERR_failinit (char *s, ...); +void ERR_fatal (char *s, ...); +void ERR_quit (void); + +#endif /* ERROR_H_INCLUDED */ diff --git a/src/files.c b/src/files.c index f6ef6b5..597d149 100644 --- a/src/files.c +++ b/src/files.c @@ -25,69 +25,56 @@ #include #include #include -#include "error.h" -#include "view.h" -#include "items.h" -#include "switch.h" #include "files.h" #include "map.h" #include "my.h" +#include "game.h" +#include "view.h" +#include "dots.h" +#include "smoke.h" +#include "fx.h" +#include "items.h" +#include "monster.h" +#include "player.h" +#include "switch.h" +#include "weapons.h" +#include "error.h" -char *S_getinfo(void); - -extern void *snd_drv; - -typedef struct{ - byte n,i,v,d; -}dmv; +typedef struct { + byte n, i, v, d; +} dmv; -byte seq[255],seqn; -dmv *pat=NULL; -unsigned *patp; -void **dmi; +int d_start, d_end; +byte savname[7][24]; +byte savok[7]; +mwad_t wad[MAX_WAD]; +map_block_t blk; +static byte seq[255]; +static byte seqn; static int inum=0; +static dmv *pat=NULL; +static unsigned *patp; +static void **dmi; -void G_savegame(FILE*); -void W_savegame(FILE*); -void DOT_savegame(FILE*); -void SMK_savegame(FILE*); -void FX_savegame(FILE*); -void IT_savegame(FILE*); -void MN_savegame(FILE*); -void PL_savegame(FILE*); -void SW_savegame(FILE*); -void WP_savegame(FILE*); - -void G_loadgame(FILE*); -void W_loadgame(FILE*); -void DOT_loadgame(FILE*); -void SMK_loadgame(FILE*); -void FX_loadgame(FILE*); -void IT_loadgame(FILE*); -void MN_loadgame(FILE*); -void PL_loadgame(FILE*); -void SW_loadgame(FILE*); -void WP_loadgame(FILE*); - -byte savname[7][24],savok[7]; - -int d_start,d_end,m_start,m_end,s_start,s_end,wad_num; -mwad_t wad[MAX_WAD]; +static int m_start, m_end; +static int s_start, s_end; +static int wad_num; -char wads[MAX_WADS][__MAX_PATH]; +static char wads[MAX_WADS][__MAX_PATH]; static FILE* wadh[MAX_WADS]; -char f_drive[__MAX_DRIVE],f_dir[__MAX_DIR],f_name[__MAX_FNAME],f_ext[__MAX_EXT], - f_path[__MAX_PATH]; +static char f_drive[__MAX_DRIVE]; +static char f_dir[__MAX_DIR]; +static char f_name[__MAX_FNAME]; +static char f_ext[__MAX_EXT]; -void F_startup(void) { +void F_startup (void) { logo("F_startup: настройка файловой системы\n"); memset(wads,0,sizeof(wads)); } -char *getsavfpname(int n, int ro) -{ +static char *getsavfpname (int n, int ro) { static char fn[]="savgame0.dat"; fn[7]=n+'0'; #ifndef WIN32 @@ -168,7 +155,7 @@ void F_loadgame (int n) { } } -void F_addwad(char *fn) { +void F_addwad (char *fn) { int i; for(i=0;i=m_end) i=m_start; @@ -403,16 +389,16 @@ void F_nextmus(char *s) { memcpy(s,wad[i].n,8); } -void F_randmus(char *s) { - int n = myrand(10); - int i; - for (i=0; i -//#include -#include +#include "glob.h" +#include // FILE +#include "map.h" // map_block_t #define MAX_WADS 20 #define MAX_WAD 2000 @@ -31,42 +32,38 @@ typedef char wadname[8]; typedef struct { - int o,l; + int o, l; char n[8]; -}wad_t; +} wad_t; typedef struct { - int o,l; + int o, l; char n[8]; int f; -}mwad_t; +} mwad_t; -void F_startup(void); -void F_addwad(char *); -void F_initwads(void); -void F_allocres(void); -//void F_preload(void); -void F_readstr(FILE*,char *,int); -void F_readstrz(FILE*,char *,int); -void F_loadres(int,void *,dword,dword); -int F_getresid(char *); -void F_getresname(char *,int); -int F_findres(char *); -int F_getsprid(char[4],int,int); -int F_getreslen(int); -void F_loadmap(char[8]); -void F_loadmus(char[8]); -void F_freemus(void); -void F_nextmus(char*); +extern int d_start, d_end; +extern byte savname[7][24]; +extern byte savok[7]; +extern mwad_t wad[MAX_WAD]; +extern map_block_t blk; -void F_getsavnames(void); -void F_loadgame(int); -void F_savegame(int,char*); +void F_startup (void); +void F_getsavnames (void); +void F_savegame (int n, char *s); +void F_loadgame (int n); +void F_addwad (char *fn); +void F_initwads (void); +void F_allocres (void); +void F_loadres (int r, void *p, dword o, dword l); +int F_findres (char *n); +int F_getresid (char *n); +void F_getresname (char *n, int r); +int F_getsprid (char n[4], int s, int d); +int F_getreslen (int r); +void F_nextmus (char *s); +void F_randmus (char *s); +void F_readstr (FILE* h, char *s, int m); +void F_loadmap (char n[8]); -void F_randmus(char*);// - -extern char wads[MAX_WADS][__MAX_PATH]; -extern int wad_num; - -int F_getsprid(char n[4],int s,int d); -int F_getresid(char *n); +#endif /* FILES_H_INCLUDED */ diff --git a/src/fx.c b/src/fx.c index 35777ac..cea21f8 100644 --- a/src/fx.c +++ b/src/fx.c @@ -36,7 +36,7 @@ static void *bsnd[2]; static char bubsn; static int last; -unsigned char fx_scr1[64000],fx_scr2[64000]; +//unsigned char fx_scr1[64000],fx_scr2[64000]; #define SINP 256 #define SINPM (SINP-1) @@ -59,8 +59,8 @@ static void setamp(int a) { for(i=0;i // FILE #define MAXFX 300 #pragma pack(1) -typedef struct{ - int x,y,xv,yv; - char t,s; -}fx_t; +typedef struct { + int x, y, xv, yv; + char t, s; +} fx_t; #pragma pack() extern fx_t fx[MAXFX]; -void FX_init(void); -void FX_alloc(void); -void FX_act(void); -void FX_tfog(int,int); -void FX_ifog(int,int); -void FX_bubble(int x,int y,int xv,int yv,int n); +void FX_savegame (FILE *h); +void FX_loadgame (FILE *h); +void FX_alloc (void); +void FX_init (void); +void FX_act (void); +void FX_tfog (int x, int y); +void FX_ifog (int x, int y); +void FX_bubble (int x, int y, int xv, int yv, int n); + +#endif /* FX_H_INLUDED */ diff --git a/src/game.c b/src/game.c index 4ae9e11..8d14674 100644 --- a/src/game.c +++ b/src/game.c @@ -42,6 +42,11 @@ #include "misc.h" #include "map.h" #include "my.h" +#include "game.h" +#include "config.h" +#include "music.h" +#include "a8.h" +#include "error.h" #include @@ -50,49 +55,30 @@ #define GETIME 1092 - -int A8_start(char*); -int A8_nextframe(void); -void A8_close(void); - - -byte transdraw=0; - - -void FX_trans1(int t); -extern unsigned char fx_scr1[64000],fx_scr2[64000]; - -extern short lastkey; - - -extern int hit_xv,hit_yv; - -//void setgamma(int); - -extern int PL_JUMP; - -extern map_block_t blk; - -extern byte cheat; - -byte _2pl=0,g_dm=0,g_st=GS_TITLE,g_exit=0,g_map=1,_warp=0; -char g_music[8]="MENU"; -byte _net=0; -int g_sttm=1092; +byte transdraw; +byte _2pl; +byte g_dm; +byte g_st = GS_TITLE; +byte g_exit; +byte g_map = 1; +char g_music[8] = "MENU"; dword g_time; -int dm_pnum,dm_pl1p,dm_pl2p; +int dm_pnum; +int dm_pl1p; +int dm_pl2p; pos_t dm_pos[100]; static void *telepsnd; -void *scrnh[3]; -void *cd_scr; -extern int sky_type; -void *ltn[2][2]; -int lt_time,lt_type,lt_side,lt_ypos,lt_force; -void *ltnsnd[2]; +int lt_time; +int lt_type; +int lt_side; +int lt_ypos; +static int lt_force; +static void *ltnsnd[2]; -int g_trans=0,g_transt; +int g_trans; +static int g_transt; static void set_trans(int st) { switch(g_st) { @@ -108,7 +94,7 @@ static void set_trans(int st) { g_trans=1;g_transt=0; } -void G_savegame(FILE* h) { +void G_savegame (FILE* h) { myfwrite8(_2pl, h); myfwrite8(g_dm, h); myfwrite8(g_exit, h); @@ -128,7 +114,7 @@ void G_savegame(FILE* h) { myfwrite(g_music, 8, 1, h); } -void G_loadgame(FILE* h) { +void G_loadgame (FILE* h) { _2pl = myfread8(h); g_dm = myfread8(h); g_exit = myfread8(h); @@ -151,18 +137,18 @@ void G_loadgame(FILE* h) { int G_load (FILE *h) { switch (blk.t) { - case MB_MUSIC: - myfread(g_music, 8, 1, h); - if (music_random) { - F_randmus(g_music); - } - F_loadmus(g_music); - return 1; + case MB_MUSIC: + myfread(g_music, 8, 1, h); + if (music_random) { + F_randmus(g_music); + } + F_loadmus(g_music); + return 1; } return 0; } -void load_game(int n) { +void load_game (int n) { F_freemus(); W_init(); F_loadgame(n); @@ -177,7 +163,7 @@ void load_game(int n) { S_startmusic(music_time); } -void G_start(void) { +void G_start (void) { char s[8]; F_freemus(); @@ -203,7 +189,7 @@ void G_start(void) { #define GGAS_TOTAL (MN__LAST-MN_DEMON+16+10) -void G_init(void) { +void G_init (void) { int i,j; char s[9]; @@ -229,7 +215,7 @@ void G_init(void) { g_trans=0; } -int G_beg_video(void) { +static int G_beg_video (void) { /* switch(g_map) { case 3: return A8_start("FALL"); @@ -255,7 +241,7 @@ int G_beg_video(void) { } -int G_end_video(void) { +static int G_end_video (void) { /* switch(g_map) { case 1: return A8_start("TRUBA"); @@ -265,8 +251,7 @@ int G_end_video(void) { return 0; } - -void G_act(void) { +void G_act (void) { static byte pcnt=0; /* if(g_trans) { @@ -302,7 +287,8 @@ void G_act(void) { case GS_ENDANIM: g_st=GS_DARKEN;break; case GS_END2ANIM: g_st=GS_END3ANIM;A8_start("KONEC");break; case GS_END3ANIM: g_st=GS_ENDSCR;lastkey=0;break; - }g_sttm=0;return; + } + return; } // V_copytoscr(0,SCRW,0,SCRH);//V_copytoscr(0,320,0,200); return; @@ -414,7 +400,7 @@ inter: #endif } -void G_respawn_player(player_t *p) { +void G_respawn_player (player_t *p) { int i; if(dm_pnum==2) { diff --git a/src/game.h b/src/game.h new file mode 100644 index 0000000..48b7898 --- /dev/null +++ b/src/game.h @@ -0,0 +1,38 @@ +#ifndef GAME_H_INLUDED +#define GAME_H_INLUDED + +#include "glob.h" +#include "view.h" // pos_t +#include "player.h" // player_t +#include // FILE + +extern byte transdraw; +extern byte _2pl; +extern byte g_dm; +extern byte g_st; +extern byte g_exit; +extern byte g_map; +extern char g_music[8]; +extern dword g_time; +extern int dm_pnum; +extern int dm_pl1p; +extern int dm_pl2p; +extern pos_t dm_pos[100]; + +extern int lt_time; +extern int lt_type; +extern int lt_side; +extern int lt_ypos; + +extern int g_trans; + +void G_savegame (FILE* h); +void G_loadgame (FILE* h); +int G_load (FILE *h); +void load_game (int n); +void G_start (void); +void G_init (void); +void G_act (void); +void G_respawn_player (player_t *p); + +#endif /* GAME_H_INLUDED */ diff --git a/src/glob.h b/src/glob.h index b68f4b6..67391c8 100644 --- a/src/glob.h +++ b/src/glob.h @@ -22,8 +22,10 @@ // Globals -#ifndef MYGLOB -#define MYGLOB +#include + +#ifndef GLOB_H_INCLUDED +#define GLOB_H_INCLUDED #ifndef NULL #define NULL 0 @@ -38,33 +40,17 @@ typedef unsigned char byte; typedef unsigned short word; typedef unsigned int dword; -void logo(const char *,...); -void logo_gas(int,int); - -extern int snd_card; -extern int _cpu; - - #define __MAX_PATH 255 #define __MAX_DRIVE 50 #define __MAX_DIR 100 #define __MAX_FNAME 50 #define __MAX_EXT 50 - #define min(a,b) ((a)<(b)?(a):(b)) #define max(a,b) ((a)>(b)?(a):(b)) #define myrand(a) (rand()%(a)) -#include -void myfread(void *ptr, size_t n, size_t size, FILE *f); -size_t myfreadc(void *ptr, size_t n, size_t size, FILE *f); -void myfwrite(void *ptr, size_t n, size_t size, FILE *f); - -extern int SCRW; -extern int SCRH; - #define DELAY 50 -#endif +#endif /* GLOB_H_INCLUDED */ diff --git a/src/items.c b/src/items.c index 8918203..49f954b 100644 --- a/src/items.c +++ b/src/items.c @@ -32,15 +32,14 @@ #include "misc.h" #include "map.h" #include "my.h" - -extern map_block_t blk; - +#include "files.h" +#include "game.h" item_t it[MAXITEM]; static void *snd[4]; -static int tsndtm,rsndtm; +static int tsndtm, rsndtm; -int itm_rtime=1092; +int itm_rtime = 1092; void IT_savegame (FILE *h) { int i, n; @@ -96,14 +95,17 @@ void IT_alloc (void) { } } -void IT_init(void) { +void IT_init (void) { int i; - - for(i=0;i=I_BPACK && t<=I_BFG) || t==I_GUN2) @@ -209,7 +211,7 @@ static void takesnd(int t) { tsndtm=Z_sound(snd[0],256); } -void IT_act(void) { +void IT_act (void) { int i,j; if(tsndtm) --tsndtm; @@ -251,7 +253,7 @@ void IT_act(void) { } } -void IT_spawn(int x,int y,int t) { +void IT_spawn (int x,int y,int t) { int i; for(i=0;i +#include "view.h" // obj_t +#include // FILE #define MAXITEM 300 -enum{I_NONE,I_CLIP,I_SHEL,I_ROCKET,I_CELL,I_AMMO,I_SBOX,I_RBOX,I_CELP, - I_STIM,I_MEDI,I_BPACK,I_CSAW,I_SGUN,I_SGUN2,I_MGUN,I_LAUN,I_PLAS,I_BFG, - I_ARM1,I_ARM2,I_MEGA,I_INVL,I_AQUA,I_KEYR,I_KEYG,I_KEYB,I_SUIT,I_SUPER, - I_RTORCH,I_GTORCH,I_BTORCH,I_GOR1,I_FCAN,I_GUN2 +enum { + I_NONE, I_CLIP, I_SHEL, I_ROCKET, I_CELL, I_AMMO, I_SBOX, I_RBOX, I_CELP, + I_STIM, I_MEDI, I_BPACK, I_CSAW, I_SGUN, I_SGUN2, I_MGUN, I_LAUN, I_PLAS, I_BFG, + I_ARM1, I_ARM2, I_MEGA, I_INVL, I_AQUA, I_KEYR, I_KEYG, I_KEYB, I_SUIT, I_SUPER, + I_RTORCH, I_GTORCH, I_BTORCH, I_GOR1, I_FCAN, I_GUN2 }; #pragma pack(1) -typedef struct{ +typedef struct { obj_t o; int t; int s; -}item_t; +} item_t; #pragma pack() extern item_t it[MAXITEM]; +extern int itm_rtime; -void IT_init(void); -void IT_alloc(void); -int IT_load(FILE*); -void IT_act(void); -void IT_spawn(int x,int y,int i); -void IT_drop_ammo(int i,int n,int x,int y); +void IT_savegame (FILE *h); +void IT_loadgame (FILE *h); +void IT_alloc (void); +void IT_init (void); +int IT_load (FILE *h); +void IT_act (void); +void IT_spawn (int x, int y, int t); +void IT_drop_ammo (int t, int n, int x, int y); -#pragma pack(1) -typedef struct{ - short x; - short y; - short t; - word f; -}thing_t; -#pragma pack() - -extern int itm_rtime; +#endif /* ITEMS_H_INCLUDED */ diff --git a/src/keyb.c b/src/keyb.c index 4123c07..7110996 100644 --- a/src/keyb.c +++ b/src/keyb.c @@ -24,32 +24,25 @@ #include "error.h" #include -// стандартная функция обработки клавиш -key_f def_key_proc; - // массив клавиш: 0 - отпущена, иначе - нажата unsigned char *keys = NULL; static key_f *key_proc = NULL; - -void K_init() -{ - keys = SDL_GetKeyState(NULL); +void K_init (void) { + keys = SDL_GetKeyState(NULL); } -void K_done() -{ - +void K_done (void) { + // not needed for sdl } + // установить функцию обработки клавиш - void K_setkeyproc(key_f *k) -{ - key_proc = k; +void K_setkeyproc (key_f *k) { + key_proc = k; } -void updatee_keys() -{ +void updatee_keys (void) { SDL_Event event; while (SDL_PollEvent (&event)) { /* diff --git a/src/keyb.h b/src/keyb.h index 0684fc5..d52559a 100644 --- a/src/keyb.h +++ b/src/keyb.h @@ -23,29 +23,16 @@ 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#ifndef MYKEYB -#define MYKEYB +#ifndef KEYB_H_INCLUDED +#define KEYB_H_INCLUDED -#ifdef __cplusplus -extern "C" { -#endif +typedef void key_f (int k, int pressed); -void K_init(); -void K_done(); - -// тип функции обработки клавиш -typedef void key_f(int k,int pressed); - -// установить функцию обработки клавиш -void K_setkeyproc(key_f *); - -// массив клавиш: 0 - отпущена, иначе - нажата extern unsigned char *keys; -void updatee_keys(); - -#ifdef __cplusplus -} -#endif +void K_init (void); +void K_done (void); +void K_setkeyproc (key_f *k); +void updatee_keys (void); -#endif +#endif /* KEYB_H_INCLUDED */ diff --git a/src/main.c b/src/main.c index 81c257c..4b6a958 100644 --- a/src/main.c +++ b/src/main.c @@ -36,24 +36,11 @@ #include "player.h" #include "my.h" #include "render.h" +#include "game.h" +#include "music.h" #include -void logo(const char *s,...) { - va_list ap; - int x,y; - - va_start(ap,s); - vprintf(s,ap); - va_end(ap); - fflush(stdout); -} - -void logo_gas(int cur,int all) { -} - -void myrandomize(void); - int main(int argc, char *argv[]) { if (SDL_Init(SDL_INIT_VIDEO)<0) ERR_failinit("Unable to init SDL: %s\n", SDL_GetError()); SDL_WM_SetCaption("Doom 2D v1.351", "Doom 2D"); diff --git a/src/map.h b/src/map.h index 5e574a6..e0afb71 100644 --- a/src/map.h +++ b/src/map.h @@ -35,6 +35,9 @@ 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +#ifndef MAP_H_INCLUDED +#define MAP_H_INCLUDED + #pragma pack(1) /* Старый формат - версия 1.04 alpha (и раньше) @@ -173,4 +176,4 @@ typedef struct{ #pragma pack() -/* КОНЕЦ */ +#endif /* MAP_H_INCLUDED */ diff --git a/src/memory.c b/src/memory.c index d3c5e8c..5be719f 100644 --- a/src/memory.c +++ b/src/memory.c @@ -27,18 +27,11 @@ #include "files.h" #include "memory.h" -dword dpmi_memavl(void); - -extern int d_start,d_end; - -extern mwad_t wad[]; - -static byte m_active=FALSE; - +static byte m_active; static void *resp[MAX_WAD]; static short resl[MAX_WAD]; -void M_startup(void) { +void M_startup (void) { if(m_active) return; logo("M_startup: настройка памяти\n"); memset(resp,0,sizeof(resp)); @@ -47,13 +40,12 @@ void M_startup(void) { m_active=TRUE; } -void M_shutdown(void) { - +void M_shutdown (void) { if(!m_active) return; m_active=FALSE; } -static void allocres(int h) { +static void allocres (int h) { int *p,s; if(h>d_start && h=MAX_WAD) ERR_fatal("M_lock: странный номер ресурса"); @@ -81,7 +73,7 @@ void *M_lock(int h) { return resp[h]; } -void M_unlock(void *p) { +void M_unlock (void *p) { int h; if(!p) return; diff --git a/src/memory.h b/src/memory.h index 84ca70f..191b8b7 100644 --- a/src/memory.h +++ b/src/memory.h @@ -19,11 +19,14 @@ 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -// High-level memory allocation +#ifndef MEMORY_H_INCLULDED +#define MEMORY_H_INCLULDED -void M_startup(void); -void M_shutdown(void); -void *M_lock(int); -void M_unlock(void *); -int M_locked(int); -int M_was_locked(int); +void M_startup (void); +void M_shutdown (void); +void *M_lock (int h); +void M_unlock (void *p); +int M_locked (int h); +int M_was_locked (int h); + +#endif /* MEMORY_H_INCLULDED */ diff --git a/src/menu.c b/src/menu.c index 7d5f374..bd225a4 100644 --- a/src/menu.c +++ b/src/menu.c @@ -35,31 +35,28 @@ #include "menu.h" #include "misc.h" #include "render.h" +#include "config.h" +#include "game.h" +#include "player.h" +#include "sound.h" +#include "music.h" #include #include -extern SDL_Surface *screen; #define QSND_NUM 14 enum{HIT100,ARMOR,JUMP,WPNS,IMMORTAL,SPEED,OPEN,EXIT}; -extern int PL_JUMP,PL_RUN; -extern byte _warp,cheat,p_fly; - -extern char g_music[8]; - -extern byte savname[7][24],savok[7]; -void load_game(int); +static byte panim[] = "BBDDAACCDDAABBDDAACCDDAABBDDAACCDDAAEEEEEFEFEFEFEFEFEFEFEFEFEEEEE"; +byte *panimp = panim; +byte _warp; -static byte panim[]= - "BBDDAACCDDAABBDDAACCDDAABBDDAACCDDAAEEEEEFEFEFEFEFEFEFEFEFEFEEEEE"; -byte *panimp=panim; - -byte pcolortab[PCOLORN]={ - 0x18,0x20,0x40,0x58,0x60,0x70,0x80,0xB0,0xC0,0xD0 +byte pcolortab[PCOLORN] = { + 0x18, 0x20, 0x40, 0x58, 0x60, 0x70, 0x80, 0xB0, 0xC0, 0xD0 }; -int p1color=5,p2color=4; +int p1color = 5; +int p2color = 4; char ibuf[24]; byte input=0; @@ -155,16 +152,14 @@ static byte cbuf[32]; static snd_t *voc=NULL; static int voc_ch=0; -extern byte shot_vga; // config.c - -void GMV_stop(void) { +static void GMV_stop (void) { if(voc) { if(voc_ch) {S_stop(voc_ch);voc_ch=0;} free(voc);voc=NULL; } } -void GMV_say(char *nm) { +void GMV_say (char *nm) { int r,len; snd_t *p; byte *d; @@ -180,7 +175,17 @@ void GMV_say(char *nm) { voc_ch=S_play(voc,-1,1024,255); } -void G_code(void) { +static void GM_set (menu_t *m) { + mnu=m;gm_redraw=1; + if(g_st==GS_GAME) { + //V_setrect(0,SCRW,0,SCRH);V_clr(0,SCRW,0,SCRH,0);//V_setrect(0,320,0,200);V_clr(0,320,0,200,0); + //if(_2pl) {V_setrect(SCRW-120,120,0,SCRH);w_o=0;Z_clrst();w_o=SCRH/2;Z_clrst();}//if(_2pl) {V_setrect(200,120,0,200);w_o=0;Z_clrst();w_o=100;Z_clrst();} + //else {V_setrect(SCRW-120,120,0,SCRH);w_o=0;Z_clrst();}//else {V_setrect(200,120,50,100);w_o=50;Z_clrst();} + //pl1.drawst=pl2.drawst=0xFF;V_setrect(0,SCRW,0,SCRH);//V_setrect(0,320,0,200); + } +} + +void G_code (void) { void *s; s=csnd2; if(memcmp(cbuf+32-5,"IDDQD",5)==0) { @@ -222,19 +227,7 @@ void G_code(void) { Z_sound(s,128); } -void GM_set(menu_t *m) { - mnu=m;gm_redraw=1; - if(g_st==GS_GAME) { - //V_setrect(0,SCRW,0,SCRH);V_clr(0,SCRW,0,SCRH,0);//V_setrect(0,320,0,200);V_clr(0,320,0,200,0); - //if(_2pl) {V_setrect(SCRW-120,120,0,SCRH);w_o=0;Z_clrst();w_o=SCRH/2;Z_clrst();}//if(_2pl) {V_setrect(200,120,0,200);w_o=0;Z_clrst();w_o=100;Z_clrst();} - //else {V_setrect(SCRW-120,120,0,SCRH);w_o=0;Z_clrst();}//else {V_setrect(200,120,50,100);w_o=50;Z_clrst();} - //pl1.drawst=pl2.drawst=0xFF;V_setrect(0,SCRW,0,SCRH);//V_setrect(0,320,0,200); - } -} - -void setgamma(int); - -void GM_command(int c) { +static void GM_command (int c) { switch(c) { case CANCEL: GM_set(NULL);break; @@ -339,28 +332,6 @@ void GM_command(int c) { } } -/* -byte keychar[2][128]={{ - 0,0,'1','2','3','4','5','6','7','8','9','0','-','=',0,0, - 'Q','W','E','R','T','Y','U','I','O','P','[',']','\r',0,'A','S', - 'D','F','G','H','J','K','L',';','\'',0,0,'\\','Z','X','C','V', - 'B','N','M',',','.','/',0,'*',0,' ',0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,'-',0,0,0,'+',0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 -},{ - 0,0,'!','\"','#','$','%',':','&','*','(',')','_','+',0,0, - 'x','x','x','x','x','x','x','x','x','x','x','x','\r',0,'x','x', - 'x','x','x','x','x','x','x','x','x',0,0,0,'x','x','x','x', - 'x','x','x','x','x','?',0,'*',0,' ',0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,'-',0,0,0,'+',0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 -}}; -*/ - struct { int keysym; byte ch; @@ -407,8 +378,7 @@ struct { {0} }; -byte get_keychar(int keysym) -{ +static byte get_keychar (int keysym) { int i = 0; while (keychar[i].keysym) { if (keychar[i].keysym == keysym) return keychar[i].ch; @@ -417,7 +387,8 @@ byte get_keychar(int keysym) return 0; } -static void shot(void) { +static void shot (void) { +/* static int num=1; char fn[100];//... #ifndef WIN32 @@ -431,9 +402,10 @@ static void shot(void) { #endif SDL_SaveBMP(screen, fn); ++num; +*/ } -int GM_act(void) { +int GM_act (void) { byte c; if(mnu==&plcolor_mnu) { @@ -540,7 +512,7 @@ int GM_act(void) { return((mnu)?1:0); } -void G_keyf(int k, int press) { +static void G_keyf (int k, int press) { int i; lastkey=k; @@ -550,7 +522,7 @@ void G_keyf(int k, int press) { } } -void GM_init(void) { +void GM_init (void) { #ifndef DEMO int i; static char nm[QSND_NUM][6]={ diff --git a/src/menu.h b/src/menu.h index ed4a5e9..3e6c65e 100644 --- a/src/menu.h +++ b/src/menu.h @@ -19,19 +19,22 @@ 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -// Game menus +#ifndef MENU_H_INCLUDED +#define MENU_H_INCLUDED -typedef struct{ +#include "glob.h" + +typedef struct { byte type; - int n,cur,x; + int n, cur, x; char *ttl; char **m; byte *t; -}menu_t; +} menu_t; extern menu_t save_mnu; - extern byte *panimp; +extern byte _warp; #define PCOLORN 10 extern byte pcolortab[PCOLORN]; @@ -43,11 +46,11 @@ extern byte input; extern menu_t *mnu; extern byte gm_redraw; +extern short lastkey; -void GMV_say(char *); -void GMV_stop(void); - -void GM_init(void); -int GM_act(void); +void GMV_say (char *nm); +void G_code (void); +int GM_act (void); +void GM_init (void); -void G_code(void); +#endif /* MENU_H_INCLUDED */ diff --git a/src/misc.h b/src/misc.h index 9d81cfa..b48cc3a 100644 --- a/src/misc.h +++ b/src/misc.h @@ -20,53 +20,49 @@ 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -// Miscellaneous functions +#ifndef MISC_H_INCLUDED +#define MISC_H_INCLUDED -#include -#include "view.h" +#include "glob.h" +#include "view.h" // obj_t +#include // int16_t int32_t #define MAXDIST 2000000L -enum{ - Z_HITWALL=1,Z_HITCEIL=2,Z_HITLAND=4,Z_FALLOUT=8, - Z_INWATER=16,Z_HITWATER=32,Z_HITAIR=64,Z_BLOCK=128 +enum { + Z_HITWALL = 1, + Z_HITCEIL = 2, + Z_HITLAND = 4, + Z_FALLOUT = 8, + Z_INWATER = 16, + Z_HITWATER = 32, + Z_HITAIR = 64, + Z_BLOCK = 128 }; -void *Z_getsnd(char[6]); -int Z_sound(void *,int); -void Z_initst(void); -int Z_sign(int); -int Z_dec(int,int); -int Z_canstand(int,int,int); -int Z_canfit(int x,int y,int r,int h); -void Z_teleobj(int o,int x,int y); -int Z_moveobj(obj_t *); -int Z_what_cpu(void); -int Z_gunhit(int,int,int,int,int); -int Z_overlap(obj_t *,obj_t *); -int Z_look(obj_t *,obj_t *,int); -int Z_hit(obj_t *,int,int,int); -int Z_hitobj(int id,int d,int o,int t); -void Z_kickobj(obj_t *,int,int,int); -void Z_explode(int,int,int,int); -void Z_bfg9000(int,int,int); -int Z_cansee(int,int,int,int); -int Z_chktrap(int,int d,int o,int t); -int Z_istrapped(int,int,int,int); -int Z_inwater(int x,int y,int r,int h); -int Z_canbreathe(int x,int y,int r,int h); -int Z_getobjpos(int,obj_t *o); +extern byte z_dot; +extern byte z_mon; -void Z_water_trap(obj_t *); -void Z_untrap(byte); - -void Z_splash(obj_t *,int n); - -void Z_set_speed(obj_t *,int); - -void Z_calc_time(dword t,word *h,word *m,word *s); - -int Z_getacid(int x,int y,int r,int h); +int Z_sign (int a); +int Z_dec (int a, int b); +void *Z_getsnd (char n[6]); +int Z_sound (void *s, int v); +void Z_initst (void); +int Z_canstand (int x, int y, int r); +int Z_canfit (int x, int y, int r, int h); +int Z_istrapped (int x, int y, int r, int h); +void Z_set_speed (obj_t *o, int s); +int Z_inwater (int x, int y, int r, int h); +int Z_getacid (int x, int y, int r, int h); +int Z_canbreathe (int x, int y, int r, int h); +int Z_overlap (obj_t *a, obj_t *b); +int Z_cansee (int x, int y, int xd, int yd); +int Z_look (obj_t *a, obj_t *b, int d); +int Z_moveobj (obj_t *p); +void Z_splash (obj_t *p, int n); +void Z_calc_time(dword t, word *h, word *m, word *s); int16_t short2host (int16_t x); int32_t int2host (int32_t x); + +#endif /* MISC_H_INCLUDED */ diff --git a/src/miscc.c b/src/miscc.c index 90cfecb..1cea2b5 100644 --- a/src/miscc.c +++ b/src/miscc.c @@ -40,13 +40,10 @@ #define MAX_YV 30 -extern dword walf[256]; - -byte z_dot=0; - -extern void *walp[256]; - +byte z_dot; +byte z_mon; static void *bulsnd[2]; +static byte wfront; int Z_sign(int a) { if(a>0) return 1; @@ -111,7 +108,7 @@ int Z_canstand(int x,int y,int r) { return 0; } -int Z_hitceil(int x,int y,int r,int h) { +static int Z_hitceil(int x,int y,int r,int h) { int i; i=(x-r)/CELW; @@ -146,7 +143,7 @@ int Z_canfit(int x,int y,int r,int h) { return 1; } -int Z_inlift(int x,int y,int r,int h) { +static int Z_inlift(int x,int y,int r,int h) { int i,j,sx,sy; sx=(x-r)/CELW; @@ -163,7 +160,7 @@ int Z_inlift(int x,int y,int r,int h) { return 0; } -int Z_isblocked(int x,int y,int r,int h,int xv) { +static int Z_isblocked(int x,int y,int r,int h,int xv) { int i,j,sx,sy; sx=(x-r)/CELW; @@ -206,8 +203,6 @@ void Z_set_speed(obj_t *o,int s) { o->xv=o->xv*s/m;o->yv=o->yv*s/m; } -static byte wfront; - int Z_inwater(int x,int y,int r,int h) { int i,j,sx,sy; @@ -271,7 +266,7 @@ int Z_overlap(obj_t *a,obj_t *b) { return 1; } -void Z_kickobj(obj_t *o,int x,int y,int pwr) { +static void Z_kickobj(obj_t *o,int x,int y,int pwr) { int dx,dy,m; dx=o->x-x;dy=o->y-o->h/2-y; @@ -326,8 +321,6 @@ int Z_look(obj_t *a,obj_t *b,int d) { #define wvel(v) if((xv=abs(v)+1)>5) v=Z_dec(v,xv/2-2) -byte z_mon=0; - int Z_moveobj(obj_t *p) { static int x,y,xv,yv,r,h,lx,ly,st; static byte inw; @@ -410,7 +403,7 @@ void Z_calc_time(dword t,word *h,word *m,word *s) #define SWAP_VAR(a, b) do { unsigned char t = a; a = b; b = t; } while(0) -int16_t short2swap (int16_t x) { +static int16_t short2swap (int16_t x) { union { uint8_t a[2]; int16_t x; @@ -420,7 +413,7 @@ int16_t short2swap (int16_t x) { return y.x; } -int32_t int2swap (int32_t x) { +static int32_t int2swap (int32_t x) { union { uint8_t a[4]; int32_t x; diff --git a/src/monster.c b/src/monster.c index 1357446..e895a38 100644 --- a/src/monster.c +++ b/src/monster.c @@ -36,20 +36,21 @@ #include "fx.h" #include "smoke.h" #include "my.h" +#include "player.h" +#include "error.h" +#include "game.h" #define MAX_ATM 90 -extern byte z_mon; - enum{ SLEEP,GO,RUN,CLIMB,DIE,DEAD,ATTACK,SHOOT,PAIN,WAIT,REVIVE,RUNOUT }; -typedef struct{ - int r,h,l,mp,rv,jv,sp,minp; -}mnsz_t; +typedef struct { + int r, h, l, mp, rv, jv, sp, minp; +} mnsz_t; -byte nomon=1; +byte nomon = 1; static char *sleepanim[MN_TN]={ "AAABBB","AAABBB","AAABBB","AAABBB","AAABBB","AAABBB","AAABBB","AAABBB", @@ -87,7 +88,7 @@ static char *sleepanim[MN_TN]={ "","U","U","U","","T","","","","","","","","","","","","","","W" }; -int hit_xv,hit_yv; +int hit_xv, hit_yv; mn_t mn[MAXMN]; static void *fsnd,*pauksnd,*trupsnd; @@ -120,6 +121,48 @@ static mnsz_t mnsz[MN_TN+1]={ 8, 26, 400, 70, 8,10, 30, 50 // man }; +static void setst(int i,int st) { + char *a; + int t; + + switch(mn[i].st) { + case DIE: case DEAD: + if(st!=DEAD && st!=REVIVE) return; + } + mn[i].ac=0; + t=mn[i].t-1; + switch(mn[i].st=st) { + case SLEEP: a=sleepanim[t];break; + case PAIN: a=painanim[t];break; + case WAIT: a=waitanim[t];break; + case CLIMB: + case RUN: case RUNOUT: + case GO: a=goanim[t];break; + case SHOOT: + if(t==MN_SKEL-1) {a="KKKKJJ";break;} + if(t==MN_ROBO-1) {a="MN";break;} + case ATTACK: a=attackanim[t]; + if(st==ATTACK && t==MN_VILE-1) a="[[\\\\]]"; + break; + case DIE: + if(g_map==9 && t==MN_BSP-1) Z_sound(pauksnd,128); + a=dieanim[t];break; + case DEAD: + a=deadanim[t]; + if(mn[i].ap==slopanim[t]) a=messanim[t]; + if(t==MN_BARREL-1) {mn[i].t=0;} + break; + case REVIVE: + a=(mn[i].ap==messanim[t])?slopanim[t]:dieanim[t]; + mn[i].ac=strlen(a)-1; + mn[i].o.r=mnsz[t+1].r;mn[i].o.h=mnsz[t+1].h; + mn[i].life=mnsz[t+1].l;mn[i].ammo=mn[i].pain=0; + ++mnum; + break; + } + mn[i].ap=a; +} + void MN_savegame (FILE *h) { int i, n; for (n = MAXMN - 1; n >= 0 && mn[n].t == 0; n--) { @@ -156,10 +199,6 @@ void MN_savegame (FILE *h) { myfwrite32(gsndt, h); } -static void setst(int,int); - -static int MN_hit(int n,int d,int o,int t); - void MN_loadgame (FILE *h) { int i, n, c; n = myfread32(h); @@ -201,7 +240,7 @@ void MN_loadgame (FILE *h) { #define GGAS_TOTAL (MN__LAST-MN_DEMON+16+10) -void MN_alloc(void) { +void MN_alloc (void) { int i,j; static char sn[MN_TN][5][6]={ {"DMACT","DMPAIN","SGTATK","SGTSIT","SGTDTH"}, @@ -255,56 +294,13 @@ void MN_alloc(void) { for(i=0;i<4;++i) {gsn[4]=i+'1';gsnd[i]=Z_getsnd(gsn);} } -void MN_init(void) { +void MN_init (void) { int i; - for(i=0;ix,o->y,c,t+MN_PL_DEAD))==-1) return -1; @@ -373,7 +369,7 @@ static int MN_findnewprey(int i) { return 1; } -int Z_getobjpos(int i,obj_t *o) { +int Z_getobjpos (int i, obj_t *o) { if(i==-1) {*o=pl1.o;return !PL_isdead(&pl1);} if(_2pl) if(i==-2) {*o=pl2.o;return !PL_isdead(&pl2);} if(i>=0 && i=MAXMN) return 0; + if(mn[obj].t) return MN_hit(obj,d,own,t); + return 0; +} + +void MN_act (void) { int i,st,sx,sy,t; static obj_t o; static int pt_x=0,pt_xs=1,pt_y=0,pt_ys=1; @@ -784,7 +789,7 @@ void MN_act(void) { } } -void MN_mark(void) { +void MN_mark (void) { int i; for(i=0;io.y-o.h && x>=o.x-o.r && x<=o.x+o.r) -int Z_gunhit(int x,int y,int o,int xv,int yv) { +int Z_gunhit (int x, int y, int o, int xv, int yv) { int i; if(o!=-1) if(hit(pl1.o,x,y)) if(PL_hit(&pl1,3,o,HIT_SOME)) @@ -874,7 +879,7 @@ static void goodsnd(void) { gsndt=18; } -int Z_hit(obj_t *o,int d,int own,int t) { +int Z_hit (obj_t *o, int d, int own, int t) { int i; hit_xv=o->xv+o->vx; @@ -901,24 +906,14 @@ int Z_hit(obj_t *o,int d,int own,int t) { return 0; } -void MN_killedp(void) { +void MN_killedp (void) { int i; - for(i=0;i=MAXMN) return 0; - if(mn[obj].t) return MN_hit(obj,d,own,t); - return 0; -} - -void Z_explode(int x,int y,int rad,int own) { +void Z_explode (int x,int y,int rad,int own) { long r; int dx,dy,m,i; @@ -952,7 +947,7 @@ void Z_explode(int x,int y,int rad,int own) { } } -void Z_bfg9000(int x,int y,int own) { +void Z_bfg9000 (int x,int y,int own) { int dx,dy,i; hit_xv=hit_yv=0; @@ -982,7 +977,7 @@ void Z_bfg9000(int x,int y,int own) { } } -int Z_chktrap(int t,int d,int o,int ht) { +int Z_chktrap (int t, int d, int o, int ht) { int i,s; hit_xv=hit_yv=0; @@ -1003,7 +998,7 @@ int Z_chktrap(int t,int d,int o,int ht) { return s; } -void Z_teleobj(int o,int x,int y) { +void Z_teleobj (int o, int x, int y) { obj_t *p; if(o==-1) p=&pl1.o; @@ -1014,7 +1009,7 @@ void Z_teleobj(int o,int x,int y) { Z_sound(telesnd,128); } -void MN_warning(int l,int t,int r,int b) { +void MN_warning (int l,int t,int r,int b) { int i; for(i=0;i #include short mus_vol = 50; - -Mix_Music * muslo; - char music_random = ON; int music_time = 3; int music_fade = 5; -Uint32 muscount; - -int musdisabled = 1; +static Uint32 muscount; +static Mix_Music * muslo; +static int musdisabled = 1; +static int volsetcount = 0; -void S_initmusic(void) -{ +void S_initmusic (void) { if (!SDL_WasInit(SDL_INIT_AUDIO)) { if (SDL_InitSubSystem(SDL_INIT_AUDIO) < 0) { fprintf(stderr, "\nUnable to initialize audio: %s\n", SDL_GetError()); @@ -63,8 +62,7 @@ void S_initmusic(void) S_volumemusic(mus_vol); } -void S_donemusic(void) -{ +void S_donemusic (void) { if (SDL_WasInit(SDL_INIT_AUDIO)) { F_freemus(); Mix_CloseAudio(); @@ -72,23 +70,20 @@ void S_donemusic(void) } } -void S_startmusic(int time) -{ +void S_startmusic (int time) { if (musdisabled) return; Mix_PlayMusic(muslo, -1); Mix_VolumeMusic(mus_vol); muscount=time*60*1000/DELAY; } -void S_stopmusic(void) -{ +void S_stopmusic (void) { if (musdisabled) return; Mix_HaltMusic(); muscount = 0; } -void S_volumemusic(int v) -{ +void S_volumemusic (int v) { if (musdisabled) return; mus_vol = v; if (mus_vol>128) mus_vol=128; @@ -104,7 +99,7 @@ void S_volumemusic(int v) } } -struct { +static struct { Uint8 ascii; Uint8 asciilc; char *ch; @@ -144,7 +139,7 @@ struct { {0} }; -char *get_trans_char (Uint8 c) +static char *get_trans_char (Uint8 c) { int i = 0; while (atrans[i].ascii) { @@ -157,7 +152,7 @@ char *get_trans_char (Uint8 c) return NULL; } -void trans_ascii_str (char *dest, char *src) +static void trans_ascii_str (char *dest, char *src) { char *p = dest; int i; @@ -175,7 +170,7 @@ void trans_ascii_str (char *dest, char *src) *p='\0'; } -void F_loadmus(char n[8]) { +void F_loadmus (char n[8]) { if (musdisabled) return; char f[50]; char name[50]; @@ -204,7 +199,7 @@ void F_loadmus(char n[8]) { } -void F_freemus(void) { +void F_freemus (void) { if (musdisabled) return; if (muslo) { Mix_HaltMusic(); @@ -213,12 +208,7 @@ void F_freemus(void) { muslo = NULL; } -extern char g_music[8]; - -static int volsetcount = 0; - -void S_updatemusic() -{ +void S_updatemusic (void) { if (musdisabled) return; //періодично встановлюю гучність музикі, так як вона сама підвищується до максимуму через певний час diff --git a/src/music.h b/src/music.h new file mode 100644 index 0000000..ab1d3e7 --- /dev/null +++ b/src/music.h @@ -0,0 +1,18 @@ +#ifndef MUSIC_H_INCLUDED +#define MUSIC_H_INCLUDED + +extern short mus_vol; +extern char music_random; +extern int music_time; +extern int music_fade; + +void S_initmusic (void); +void S_donemusic (void); +void S_startmusic (int time); +void S_stopmusic (void); +void S_volumemusic (int v); +void F_loadmus (char n[8]); +void F_freemus (void); +void S_updatemusic (void); + +#endif /* MUSIC_H_INCLUDED */ diff --git a/src/my.c b/src/my.c index bfae25f..a966eb8 100644 --- a/src/my.c +++ b/src/my.c @@ -28,8 +28,7 @@ #include #include -void mysplitpath(const char* path, char* drv, char* dir, char* name, char* ext) -{ +void mysplitpath(const char* path, char* drv, char* dir, char* name, char* ext) { const char* end; /* end of processed string */ const char* p; /* search pointer */ const char* s; /* copy pointer */ @@ -127,13 +126,11 @@ void myfwrite32 (int32_t x, FILE *f) { myfwrite(&x, 4, 1, f); } -void myrandomize(void) -{ +void myrandomize (void) { srand(SDL_GetTicks()); } -int fexists(char * filename) -{ +int fexists (char *filename) { FILE *f; if ((f = fopen(filename, "r"))) { @@ -141,4 +138,4 @@ int fexists(char * filename) return 1; } return 0; -} \ No newline at end of file +} diff --git a/src/my.h b/src/my.h index f52be8b..15792f1 100644 --- a/src/my.h +++ b/src/my.h @@ -19,30 +19,28 @@ 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#ifdef __cplusplus -extern "C" { -#endif +#ifndef MY_H_INCLUDED +#define MY_H_INCLUDED -#include -#include +#include // int16_t int32_t +#include // FILE -void mysplitpath (const char *path, char *drv, char *dir, char *name, char *ext); +void mysplitpath(const char* path, char* drv, char* dir, char* name, char* ext); -size_t myfreadc(void *ptr, size_t size, size_t n, FILE *f); +size_t myfreadc (void *ptr, size_t size, size_t n, FILE *f); void myfread (void *ptr, size_t size, size_t n, FILE *f); int8_t myfread8 (FILE *f); int16_t myfread16 (FILE *f); int32_t myfread32 (FILE *f); -void myfwrite(void *ptr, size_t size, size_t n, FILE *f); +void myfwrite (void *ptr, size_t size, size_t n, FILE *f); void myfwrite8 (int8_t x, FILE *f); void myfwrite16 (int16_t x, FILE *f); void myfwrite32 (int32_t x, FILE *f); void myrandomize (void); + int fexists (char *filename); -#ifdef __cplusplus -} -#endif +#endif /* MY_H_INCLUDED */ diff --git a/src/player.c b/src/player.c index 7a693ac..f593f30 100644 --- a/src/player.c +++ b/src/player.c @@ -35,8 +35,7 @@ #include "player.h" #include "misc.h" #include "my.h" - -extern int hit_xv,hit_yv; +#include "game.h" #define PL_RAD 8 #define PL_HT 26 @@ -46,25 +45,28 @@ extern int hit_xv,hit_yv; #define PL_AQUA_AIR 1091 -byte p_immortal=0,p_fly=0; +byte p_immortal; +byte p_fly; -int PL_JUMP=10,PL_RUN=8; +int PL_JUMP=10; +int PL_RUN=8; -int wp_it[11]={0,I_CSAW,0,I_SGUN,I_SGUN2,I_MGUN,I_LAUN,I_PLAS,I_BFG,I_GUN2,0}; +static int wp_it[11]={0,I_CSAW,0,I_SGUN,I_SGUN2,I_MGUN,I_LAUN,I_PLAS,I_BFG,I_GUN2,0}; enum{STAND,GO,DIE,SLOP,DEAD,MESS,OUT,FALL}; typedef void fire_f(int,int,int,int,int); -player_t pl1,pl2; +player_t pl1; +player_t pl2; static int aitime; static void *aisnd[3]; static void *pdsnd[5]; static void *snd[11]; -byte plr_goanim[]="BDACDA", - plr_dieanim[]="HHHHIIIIJJJJKKKKLLLLMMMM", - plr_slopanim[]="OOPPQQRRSSTTUUVVWW"; +byte plr_goanim[]="BDACDA"; +byte plr_dieanim[]="HHHHIIIIJJJJKKKKLLLLMMMM"; +byte plr_slopanim[]="OOPPQQRRSSTTUUVVWW"; #pragma pack(1) @@ -73,7 +75,7 @@ struct { } _keys; #pragma pack() -void PL_save_player (player_t *p, FILE *h) { +static void PL_save_player (player_t *p, FILE *h) { myfwrite32(p->o.x, h); myfwrite32(p->o.y, h); myfwrite32(p->o.xv, h); @@ -127,7 +129,7 @@ void PL_savegame (FILE *h) { myfwrite8(p_immortal, h); } -void PL_load_player (player_t *p, FILE *h) { +static void PL_load_player (player_t *p, FILE *h) { p->o.x = myfread32(h); p->o.y = myfread32(h); p->o.xv = myfread32(h); @@ -181,7 +183,9 @@ void PL_loadgame (FILE *h) { p_immortal = myfread8(h); } -static int nonz(int a) {return (a)?a:1;} +static int nonz (int a) { + return a ? a : 1; +} static int firediry(player_t *p) { if(p->f&PLF_UP) return -42; @@ -283,7 +287,7 @@ static void jump(player_t *p,int st) { } } -int PL_isdead(player_t *p) { +int PL_isdead (player_t *p) { switch(p->st) { case DEAD: case MESS: case OUT: @@ -292,7 +296,7 @@ int PL_isdead(player_t *p) { return 0; } -void PL_init(void) { +void PL_init (void) { p_immortal=0; PL_JUMP=10;PL_RUN=8; aitime=0; @@ -327,7 +331,7 @@ void PL_alloc(void) { } } -void PL_restore(player_t *p) { +static void PL_restore(player_t *p) { p->o.xv=p->o.yv=p->o.vx=p->o.vy=0; p->o.r=PL_RAD;p->o.h=PL_HT; p->pain=0; @@ -349,18 +353,18 @@ void PL_restore(player_t *p) { p->keys=(g_dm)?0x70:0; } -void PL_reset(void) { +void PL_reset (void) { pl1.st=pl2.st=DEAD; pl1.frag=pl2.frag=0; } -void PL_spawn(player_t *p,int x,int y,char d) { +void PL_spawn (player_t *p,int x,int y,char d) { PL_restore(p); p->o.x=x;p->o.y=y;p->d=d; p->kills=p->secrets=0; } -int PL_hit(player_t *p,int d,int o,int t) { +int PL_hit (player_t *p,int d,int o,int t) { if(!d) return 0; switch(p->st) { case DIE: case SLOP: @@ -382,7 +386,7 @@ int PL_hit(player_t *p,int d,int o,int t) { return 1; } -void PL_damage(player_t *p) { +void PL_damage (player_t *p) { int i; if(!p->hit && p->life>0) return; @@ -426,12 +430,12 @@ void PL_damage(player_t *p) { return; } -void PL_cry(player_t *p) { +void PL_cry (player_t *p) { Z_sound(snd[(p->pain>20)?1:0],128); p->f|=PLF_PNSND; } -int PL_give(player_t *p,int t) { +int PL_give (player_t *p, int t) { int i; switch(p->st) { @@ -553,7 +557,7 @@ int PL_give(player_t *p,int t) { } } -void PL_act(player_t *p) { +void PL_act (player_t *p) { int st; if(--aitime<0) aitime=0; @@ -660,7 +664,7 @@ static void chk_bfg(player_t *p,int x,int y) { } } -void bfg_fly(int x,int y,int o) { +void bfg_fly (int x,int y,int o) { // if(!g_dm) return; if(o!=-1) chk_bfg(&pl1,x,y); if(_2pl) if(o!=-2) chk_bfg(&pl2,x,y); diff --git a/src/player.h b/src/player.h index 2ddb96f..db4f992 100644 --- a/src/player.h +++ b/src/player.h @@ -20,7 +20,12 @@ 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -// Player data and functions +#ifndef PLAYER_H_INCLUDED +#define PLAYER_H_INCLUDED + +#include "glob.h" +#include "view.h" // obj_t +#include // FILE #define PL_DRAWLIFE 1 #define PL_DRAWARMOR 2 @@ -50,17 +55,16 @@ #define PL_POWERUP_TIME 546 #pragma pack(1) -typedef struct{ +typedef struct { obj_t o; int looky; - int st,s; - int life,armor,hit,hito; - int pain,air; - int invl,suit; + int st, s; + int life, armor, hit, hito; + int pain, air; + int invl, suit; char d; - //byte ku,kd,kl,kr,kf,kj,kwl,kwr,kp; - int frag,ammo,shel,rock,cell,fuel,kills,secrets; - byte fire,cwpn,csnd; + int frag, ammo, shel, rock, cell, fuel, kills, secrets; + byte fire, cwpn, csnd; byte amul; word wpns; char wpn; @@ -70,24 +74,34 @@ typedef struct{ int id; byte keys; char lives; - int ku,kd,kl,kr,kf,kj,kwl,kwr,kp; -}player_t; + int ku, kd, kl, kr, kf, kj, kwl, kwr, kp; +} player_t; #pragma pack() -extern byte plr_goanim[], plr_dieanim[], plr_slopanim[]; - extern byte p_immortal; -extern player_t pl1, pl2; - -void PL_init(void); -void PL_alloc(void); -void PL_spawn(player_t *,int,int,char); -int PL_hit(player_t *,int,int,int); -int PL_isdead(player_t *); -void PL_act(player_t *); -void PL_cry(player_t *); -void PL_damage(player_t *); -int PL_give(player_t *,int); -void G_respawn_player(player_t *); - -void PL_reset(void); +extern byte p_fly; +extern int PL_JUMP; +extern int PL_RUN; + +extern player_t pl1; +extern player_t pl2; + +extern byte plr_goanim[]; +extern byte plr_dieanim[]; +extern byte plr_slopanim[]; + +void PL_savegame (FILE *h); +void PL_loadgame (FILE *h); +int PL_isdead (player_t *p); +void PL_init (void); +void PL_alloc (void); +void PL_reset (void); +void PL_spawn (player_t *p, int x, int y, char d); +int PL_hit (player_t *p, int d, int o, int t); +void PL_damage (player_t *p); +void PL_cry (player_t *p); +int PL_give (player_t *p, int t); +void PL_act (player_t *p); +void bfg_fly (int x, int y, int o); + +#endif /* PLAYER_H_INCLUDED */ diff --git a/src/render.c b/src/render.c index 254b87e..b0f2485 100644 --- a/src/render.c +++ b/src/render.c @@ -19,6 +19,9 @@ #include "memory.h" #include "files.h" #include "error.h" +#include "game.h" +#include "sound.h" +#include "music.h" // game static vgaimg *scrnh[3]; // TITLEPIC INTERPIC ENDPIC @@ -61,6 +64,8 @@ static byte gamcor[5][64]={ }; // walls #define ANIT 5 +static int WD, HT; +static int w_o, w_x, w_y; static vgaimg *walp[256]; static int walh[256]; static byte walani[256]; @@ -69,20 +74,6 @@ static byte anic[ANIT]; static int max_textures; static vgaimg *horiz; -extern byte bright[256]; // vga.c -extern byte mixmap[256][256]; // vga.c -extern byte clrmap[256*12]; // vga.c - -extern int g_trans; // game.c -extern byte transdraw; // game.c -extern int sky_type; // view.c -extern int lt_time, lt_type, lt_side, lt_ypos, lt_force; // game.c - -extern byte savname[7][24]; // files.c -extern char g_music[8]; // game.c -extern short snd_vol; // sound.c -extern short mus_vol; // music.c - /* --- misc --- */ static void *Z_getspr (char n[4], int s, int d, char *dir) { @@ -1376,7 +1367,7 @@ void R_init () { } R_setgamma(gammaa); V_setrect(0, SCRW, 0, SCRH); - V_setscr(scrbuf); +// V_setscr(scrbuf); V_clr(0, SCRW, 0, SCRH, 0); R_alloc(); } diff --git a/src/render.h b/src/render.h index 9226e99..71d4365 100644 --- a/src/render.h +++ b/src/render.h @@ -1,3 +1,8 @@ +#ifndef RENDER_H_INCLUDED +#define RENDER_H_INCLUDED + +extern int SCRW, SCRH; // from vga.c + void R_draw (void); void R_alloc (void); void R_init (void); @@ -13,3 +18,5 @@ void R_begin_load (void); void R_load (char s[8], int f); void R_end_load (void); void R_loadsky (int sky); + +#endif /* RENDER_H_INCLUDED */ diff --git a/src/smoke.c b/src/smoke.c index 6ccb15a..19bf714 100644 --- a/src/smoke.c +++ b/src/smoke.c @@ -24,9 +24,11 @@ #include #include "view.h" #include "smoke.h" +#include "game.h" #include "fx.h" #include "misc.h" #include "my.h" +#include "monster.h" #define MAXSR 20 @@ -73,7 +75,7 @@ void SMK_loadgame (FILE *h) { } } -void SMK_init(void) { +void SMK_init (void) { int i; for(i=0;i=MAXSMOK) lsm=0; } -void SMK_act(void) { +void SMK_act (void) { int i,ox,oy; static obj_t o; @@ -139,7 +141,7 @@ void SMK_act(void) { } } -void SMK_add(int x,int y,int xv,int yv,byte t,byte s,short o) { +static void SMK_add (int x, int y, int xv, int yv, byte t, byte s, short o) { int i; if(!Z_canfit(x>>8,(y>>8)+3,3,7)) return; @@ -152,7 +154,7 @@ void SMK_add(int x,int y,int xv,int yv,byte t,byte s,short o) { inclast(); } -void SMK_gas(int x0,int y0,int xr,int yr,int xv,int yv,int k) { +void SMK_gas (int x0, int y0, int xr, int yr, int xv, int yv, int k) { int i,x,y; static int sxv,syv; @@ -168,7 +170,7 @@ void SMK_gas(int x0,int y0,int xr,int yr,int xv,int yv,int k) { } } -void SMK_flame(int x0,int y0,int ox,int oy,int xr,int yr,int xv,int yv,int k,int o) { +void SMK_flame (int x0, int y0, int ox, int oy, int xr, int yr, int xv, int yv, int k, int o) { int i,x,y; static int sxv,syv; diff --git a/src/smoke.h b/src/smoke.h index 1f33f1d..8ba0a0f 100644 --- a/src/smoke.h +++ b/src/smoke.h @@ -19,7 +19,11 @@ 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -// Smoke +#ifndef SMOKE_H_INLUDED +#define SMOKE_H_INLUDED + +#include "glob.h" +#include // FILE #define MAXSMOK 500 @@ -27,18 +31,21 @@ #define FLSN 8 #pragma pack(1) -typedef struct{ - int x,y,xv,yv; - byte t,s; +typedef struct { + int x, y, xv, yv; + byte t, s; short o; -}smoke_t; +} smoke_t; #pragma pack() extern smoke_t sm[MAXSMOK]; -void SMK_init(void); -void SMK_alloc(void); -void SMK_act(void); -void SMK_add(int x,int y,int xv,int yv,byte t,byte s,short o); -void SMK_gas(int x,int y,int rx,int ry,int xv,int yv,int k); -void SMK_flame(int x,int y,int ox,int oy,int rx,int ry,int xv,int yv,int k,int o); +void SMK_savegame (FILE *h); +void SMK_loadgame (FILE *h); +void SMK_init (void); +void SMK_alloc (void); +void SMK_act (void); +void SMK_gas (int x0, int y0, int xr, int yr, int xv, int yv, int k); +void SMK_flame (int x0, int y0, int ox, int oy, int xr, int yr, int xv, int yv, int k, int o); + +#endif /* SMOKE_H_INLUDED */ diff --git a/src/sound.c b/src/sound.c index de33434..2fe510b 100644 --- a/src/sound.c +++ b/src/sound.c @@ -31,15 +31,13 @@ short snd_vol = 50; -int snddisabled = 1; - -struct { +static int snddisabled = 1; +static struct { snd_t *s; Mix_Chunk *c; } chunks[NUM_CHUNKS]; -void S_init(void) -{ +void S_init (void) { if (!SDL_WasInit(SDL_INIT_AUDIO)) { if (SDL_InitSubSystem(SDL_INIT_AUDIO) < 0) { fprintf(stderr, "\nUnable to initialize audio: %s\n", SDL_GetError()); @@ -71,8 +69,7 @@ void S_init(void) S_volume(snd_vol); } -void S_done(void) -{ +void S_done (void) { free_chunks(); if (SDL_WasInit(SDL_INIT_AUDIO)) { Mix_CloseAudio(); @@ -80,8 +77,7 @@ void S_done(void) } } -Mix_Chunk * get_chunk(snd_t *s, int r, int v) -{ +static Mix_Chunk *get_chunk (snd_t *s, int r, int v) { int i, fi = -1; for(i=0; i128) snd_vol=128; @@ -149,8 +141,7 @@ void S_volume(int v) Mix_Volume(-1, snd_vol); } -void S_wait() -{ +void S_wait (void) { if (snddisabled) return; while (Mix_Playing(-1)) { SDL_Delay(10); diff --git a/src/sound.h b/src/sound.h index dc46f7c..5f71e34 100644 --- a/src/sound.h +++ b/src/sound.h @@ -24,55 +24,36 @@ 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#ifdef __cplusplus -extern "C" { -#endif +#ifndef SOUND_H_INCLUDED +#define SOUND_H_INCLUDED // заголовок инструмента (DMI) #pragma pack(1) -typedef struct{ - unsigned int len, // длина в байтах - rate, // частота в Гц. - lstart, // начало повтора в байтах от начала данных - llen; // длина повтора в байтах -}snd_t; +typedef struct { + unsigned int len; // длина в байтах + unsigned int rate; // частота в Гц. + unsigned int lstart; // начало повтора в байтах от начала данных + unsigned int llen; // длина повтора в байтах +} snd_t; #pragma pack() -void S_init(void); +// громкость звука и музыки (0-128) +extern short snd_vol; -void S_done(void); +void S_init (void); +void S_done (void); // проиграть звук s на канале c (1-8), частоте r и громкости v (0-255) // возвращает номер канала, на котором играется звук // если c==0, то звук попадет в любой свободный канал // r - это относительная частота (обычно 1024) -short S_play(snd_t *s,short c,unsigned r,short v); +short S_play (snd_t *s, short c, unsigned r, short v); // остановить звук на канале c (1-8) -void S_stop(short c); - -void S_startmusic(int); - -void S_stopmusic(void); - -void S_updatemusic(void); - -// громкость звука и музыки (0-128) -extern short snd_vol,mus_vol; - -void S_volumemusic(int v); -void S_volume(int v); -void free_chunks(); -void S_wait(); - -extern char music_random; -extern int music_time; -extern int music_fade; +void S_stop (short c); -void F_freemus(void); -void S_initmusic(void); -void S_donemusic(void); +void S_volume (int v); +void free_chunks (void); +void S_wait (void); -#ifdef __cplusplus -} -#endif +#endif /* SOUND_H_INCLUDED */ diff --git a/src/switch.c b/src/switch.c index a046508..b04c303 100644 --- a/src/switch.c +++ b/src/switch.c @@ -28,27 +28,28 @@ #include "player.h" #include "misc.h" #include "map.h" +#include "files.h" +#include "game.h" #include "my.h" +#include "monster.h" #define MAXSW 100 -extern map_block_t blk; - #pragma pack(1) -typedef struct{ - byte x,y; - byte t,tm; - byte a,b,c,d; +typedef struct { + byte x, y; + byte t, tm; + byte a, b, c, d; byte f; -}sw_t; +} sw_t; #pragma pack() -static sw_t sw[MAXSW]; +int sw_secrets; -static void *sndswn,*sndswx,*sndnoway,*sndbdo,*sndbdc,*sndnotele; +static sw_t sw[MAXSW]; +static void *sndswn, *sndswx, *sndnoway, *sndbdo, *sndbdc, *sndnotele; static int swsnd; - -int sw_secrets; +static byte cht, chto, chf, f_ch; void SW_savegame (FILE *h) { int i, n; @@ -91,31 +92,31 @@ void SW_loadgame (FILE *h) { int SW_load (FILE *h) { int i; switch(blk.t) { - case MB_SWITCH2: - sw_secrets = 0; - for (i = 0; i < MAXSW && blk.sz > 0; ++i, blk.sz -= 9) { - sw[i].x = myfread8(h); - sw[i].y = myfread8(h); - sw[i].t = myfread8(h); - sw[i].tm = myfread8(h); // unused - sw[i].a = myfread8(h); - sw[i].b = myfread8(h); - sw[i].c = myfread8(h); - sw[i].d = myfread8(h); // unused - sw[i].f = myfread8(h); - sw[i].tm = 0; - sw[i].d = 0; - sw[i].f |= 0x80; - if (sw[i].t == SW_SECRET) { - ++sw_secrets; + case MB_SWITCH2: + sw_secrets = 0; + for (i = 0; i < MAXSW && blk.sz > 0; ++i, blk.sz -= 9) { + sw[i].x = myfread8(h); + sw[i].y = myfread8(h); + sw[i].t = myfread8(h); + sw[i].tm = myfread8(h); // unused + sw[i].a = myfread8(h); + sw[i].b = myfread8(h); + sw[i].c = myfread8(h); + sw[i].d = myfread8(h); // unused + sw[i].f = myfread8(h); + sw[i].tm = 0; + sw[i].d = 0; + sw[i].f |= 0x80; + if (sw[i].t == SW_SECRET) { + ++sw_secrets; + } } - } - return 1; + return 1; } return 0; } -void SW_alloc(void) { +void SW_alloc (void) { sndswn=Z_getsnd("SWTCHN"); sndswx=Z_getsnd("SWTCHX"); sndnoway=Z_getsnd("NOWAY"); @@ -124,15 +125,14 @@ void SW_alloc(void) { sndnotele=Z_getsnd("NOTELE"); } -void SW_init(void) { +void SW_init (void) { int i; - - for(i=0;iy)>=FLDH*CELH+o->h) return; @@ -166,7 +166,7 @@ void Z_water_trap(obj_t *o) { } } -void Z_untrap(byte t) { +void Z_untrap (byte t) { byte *p; word n; @@ -205,7 +205,7 @@ static int shutdoor(int i) { return 1; } -void SW_act(void) { +void SW_act (void) { int i; if(swsnd) --swsnd; @@ -233,7 +233,7 @@ static int doortime(int t) { return 0; } -void SW_cheat_open(void) { +void SW_cheat_open (void) { int i; for(i=0;i +#include // FILE +#include "view.h" // obj_t -enum{ - SW_NONE,SW_EXIT,SW_EXITS,SW_OPENDOOR,SW_SHUTDOOR,SW_SHUTTRAP, - SW_DOOR,SW_DOOR5,SW_PRESS,SW_TELE,SW_SECRET,SW_LIFTUP,SW_LIFTDOWN,SW_TRAP, - SW_LIFT +enum { + SW_NONE, SW_EXIT, SW_EXITS, SW_OPENDOOR, SW_SHUTDOOR, SW_SHUTTRAP, + SW_DOOR, SW_DOOR5, SW_PRESS, SW_TELE, SW_SECRET, SW_LIFTUP, SW_LIFTDOWN, + SW_TRAP, SW_LIFT }; extern int sw_secrets; -void SW_init(void); -void SW_alloc(void); -int SW_load(FILE*); -void SW_act(void); -int SW_press(int x,int y,int r,int h,byte t,int o); - -void SW_cheat_open(void); +void SW_savegame (FILE *h); +void SW_loadgame (FILE *h); +int SW_load (FILE *h); +void SW_alloc (void); +void SW_init (void); +void Z_water_trap (obj_t *o); +void Z_untrap (byte t); +void SW_act (void); +void SW_cheat_open (void); +int SW_press (int x, int y, int r, int h, byte t, int o); + +#endif /* SWITCH_H_INCLUDED */ diff --git a/src/vga.c b/src/vga.c index 0d16859..8347b3a 100644 --- a/src/vga.c +++ b/src/vga.c @@ -33,30 +33,26 @@ // адрес экранного буфера -unsigned char *scra; +//unsigned char *scra; // виртуальный экран -unsigned char scrbuf[64000]; - +//unsigned char scrbuf[64000]; int SCRW = 800; int SCRH = 600; - -SDL_Surface* screen = NULL; - -int cx1,cx2,cy1,cy2; - char fullscreen = OFF; byte bright[256]; byte mixmap[256][256]; byte clrmap[256*12]; +static SDL_Surface* screen = NULL; +static int cx1,cx2,cy1,cy2; static byte flametab[16] = { 0xBC,0xBA,0xB8,0xB6,0xB4,0xB2,0xB0,0xD5,0xD6,0xD7,0xA1,0xA0,0xE3,0xE2,0xE1,0xE0 }; - -extern void *walp[256]; +static int offx = 0; +static int offy = 0; #define HQ 2 @@ -76,8 +72,7 @@ vgaimg *V_loadvgaimg (char *name) { return V_getvgaimg(F_getresid(name)); } -short V_init(void) -{ +short V_init (void) { Uint32 flags = SDL_SWSURFACE|SDL_DOUBLEBUF|SDL_HWPALETTE; if (fullscreen) flags = flags | SDL_FULLSCREEN; screen = SDL_SetVideoMode(SCRW, SCRH, 8, flags); @@ -88,13 +83,11 @@ short V_init(void) } // переключение в текстовый режим -void V_done(void) -{ +void V_done (void) { SDL_Quit(); } -void draw_rect (int x, int y, int w, int h, int c) -{ +static void draw_rect (int x, int y, int w, int h, int c) { SDL_Rect dstrect; dstrect.x = x*HQ; dstrect.y = y*HQ; @@ -104,8 +97,7 @@ void draw_rect (int x, int y, int w, int h, int c) } // установить область вывода -void V_setrect(short x,short w,short y,short h) -{ +void V_setrect (short x,short w,short y,short h) { SDL_Rect r; r.x=x*HQ; r.y=y*HQ; @@ -123,8 +115,7 @@ void V_setrect(short x,short w,short y,short h) if (cy2>=SCRH) cy2=SCRH-1; } -void putpixel(int x, int y, Uint8 color) -{ +static void putpixel (int x, int y, Uint8 color) { if(x>=cx1 && x<=cx2 && y>=cy1 && y<=cy2) { x*=HQ; y*=HQ; @@ -137,8 +128,7 @@ void putpixel(int x, int y, Uint8 color) } } -byte getpixel(int x, int y) -{ +static byte getpixel (int x, int y) { if(x>=cx1 && x<=cx2 && y>=cy1 && y<=cy2) { x*=HQ; y*=HQ; @@ -147,29 +137,22 @@ byte getpixel(int x, int y) return 0; } -void mappixel(int x,int y,byte* cmap) -{ +static void mappixel (int x, int y, byte* cmap) { byte c = getpixel(x,y); putpixel(x,y,cmap[c]); } -int offx = 0; -int offy = 0; - -void V_center(int f) -{ +void V_center (int f) { if (f) V_offset(SCRW/2-320/2, SCRH/2-200/2); else V_offset(0, 0); } -void V_offset(int ox, int oy) -{ +void V_offset (int ox, int oy) { offx=ox; offy=oy; } -void draw_spr(short x,short y,vgaimg *i, int d, int c) -{ +static void draw_spr (short x, short y, vgaimg *i, int d, int c) { if (i==NULL) return; x += offx; y += offy; @@ -194,36 +177,30 @@ void draw_spr(short x,short y,vgaimg *i, int d, int c) } } -void V_rotspr (int x, int y, vgaimg* i, int d) -{ +void V_rotspr (int x, int y, vgaimg* i, int d) { x+=i->w*((d&1)?1:0); y+=i->h*((d&2)?1:0); draw_spr(x,y,i,d,0); } -void V_pic(short x,short y,vgaimg *i) -{ - draw_spr(x,y,i, 0, 0); +void V_pic (short x, short y, vgaimg *i) { + draw_spr(x, y, i, 0, 0); } -void V_manspr(int x,int y,void *p, unsigned char c) -{ - draw_spr(x,y,p, 0, c); +void V_manspr (int x, int y, void *p, unsigned char c) { + draw_spr(x, y, p, 0, c); } -void V_manspr2(int x,int y,void *p, unsigned char c) -{ - draw_spr(x,y,p, 1, c); +void V_manspr2(int x,int y,void *p, unsigned char c) { + draw_spr(x, y, p, 1, c); } // вывести точку цвета c в координатах (x,y) -void V_dot(short x,short y, unsigned char c) -{ +void V_dot (short x,short y, unsigned char c) { putpixel(x,y,c); } -void smoke_sprf(int x, int y, byte c) -{ +void smoke_sprf (int x, int y, byte c) { byte t = getpixel(x,y); c = c + bright[t]; c += 0x60; @@ -231,15 +208,13 @@ void smoke_sprf(int x, int y, byte c) putpixel(x,y,mixmap[c][t]); } -void flame_sprf(int x, int y, byte c) -{ +void flame_sprf (int x, int y, byte c) { byte t = getpixel(x,y); c = c + bright[t]; putpixel(x,y,flametab[c]); } -void V_sprf(short x,short y,vgaimg *i,spr_f *f) -{ +void V_sprf (short x,short y,vgaimg *i,spr_f *f) { if (i==NULL) return; x-=i->sx; y-=i->sy; @@ -256,30 +231,20 @@ void V_sprf(short x,short y,vgaimg *i,spr_f *f) } } -void V_spr(short x,short y,vgaimg *i) -{ - draw_spr(x,y,i,0, 0); +void V_spr (short x, short y, vgaimg *i) { + draw_spr(x, y, i, 0, 0); } -void V_spr2(short x,short y,vgaimg *i) -{ +void V_spr2 (short x, short y, vgaimg *i) { draw_spr(x,y,i,1,0); } -void V_clr(short x,short w,short y,short h,unsigned char c) -{ - draw_rect(x,y,w,h, c); -} - -// установить палитру из массива p -void VP_setall(void *p) -{ - VP_set(p, 0, 256); +void V_clr (short x, short w, short y, short h, unsigned char c) { + draw_rect(x, y, w, h, c); } // установить n цветов, начиная с f, из массива p -void VP_set(void *p,short f,short n) -{ +static void VP_set (void *p, short f, short n) { byte *ptr = (byte*)p; SDL_Color colors[256]; int i; @@ -293,22 +258,24 @@ void VP_set(void *p,short f,short n) SDL_SetPalette(screen, SDL_LOGPAL|SDL_PHYSPAL, colors, f, n); } +// установить палитру из массива p +void VP_setall (void *p) { + VP_set(p, 0, 256); +} + // установить адрес экранного буфера // NULL - реальный экран -void V_setscr(void *p) -{ +void V_setscr (void *p) { if (screen) SDL_Flip(screen); } // скопировать прямоугольник на экран -void V_copytoscr(short x,short w,short y,short h) -{ +void V_copytoscr (short x, short w, short y, short h) { x*=HQ; y*=HQ; w*=HQ; h*=HQ; SDL_UpdateRect(screen, x, y, w, h); } -void V_maptoscr(int x,int w,int y,int h,void *cmap) -{ +void V_maptoscr (int x, int w, int y, int h, void *cmap) { int cx,cy; for (cx=x; cxformat->palette->ncolors; SDL_Color colors[256]; diff --git a/src/vga.h b/src/vga.h index 48392c2..44f1d48 100644 --- a/src/vga.h +++ b/src/vga.h @@ -24,219 +24,95 @@ 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#ifdef __cplusplus -extern "C" { -#endif +#ifndef VGA_H_INCLUDED +#define VGA_H_INCLUDED + +#include "glob.h" -// заголовок изображения #pragma pack(1) -typedef struct{ - unsigned short w,h; // W-ширина,H-высота - short sx,sy; // сдвиг центра изображения -}vgaimg; - -// R-красный,G-зеленый,B-синий -typedef struct{ - unsigned char r,g,b; -}rgb_t; +typedef struct { + unsigned short w, h; // W-ширина,H-высота + short sx, sy; // сдвиг центра изображения +} vgaimg; #pragma pack() -// 256-и цветовая палитра VGA -typedef rgb_t vgapal[256]; - // карта цветов typedef unsigned char colormap[256]; -// тип функции перерисовки экрана -typedef void redraw_f(void); +typedef void spr_f(int, int, unsigned char); + +extern int SCRW; +extern int SCRH; +extern char fullscreen; -typedef void spr_f(int, int, unsigned char);//typedef void spr_f(void); +extern byte bright[256]; +extern byte mixmap[256][256]; +extern byte clrmap[256*12]; vgaimg *V_getvgaimg (int id); vgaimg *V_loadvgaimg (char *name); // переключение в режим VGA 320x200,256 цветов // возвращает 0, если все о'кей -short V_init(void); +short V_init (void); // переключение в текстовый режим -void V_done(void); +void V_done (void); // ждать обратного хода луча развертки -void V_wait(void); +void V_wait (void); // вывести картинку i в координатах (x,y) -void V_pic(short x,short y,vgaimg *i); +void V_pic (short x, short y, vgaimg *i); // вывести спрайт i в координатах (x,y) при помощи функции f // параметры: AL=цвет_точки_спрайта EDI=>экран // !!! сохраняйте все регистры, кроме EAX // !!! EDI должен быть переведен на точку вправо (INC EDI или STOSB) -void V_sprf(short x,short y,vgaimg *i,spr_f *f); +void V_sprf (short x, short y, vgaimg *i, spr_f *f); -void smoke_sprf(int x, int y, unsigned char c); -void flame_sprf(int x, int y, unsigned char c); +void smoke_sprf (int x, int y, unsigned char c); +void flame_sprf (int x, int y, unsigned char c); // вывести спрайт i в координатах (x,y) -void V_spr(short x,short y,vgaimg *i); +void V_spr (short x, short y, vgaimg *i); // вывести зеркально перевернутый спрайт i в координатах (x,y) -void V_spr2(short x,short y,vgaimg *i); - -// вывести форму спрайта i в координатах (x,y) одним цветом c -// (подходит для рисования теней) -void V_spr1color(short x,short y,vgaimg *i,unsigned char c); +void V_spr2 (short x, short y, vgaimg *i); // вывести точку цвета c в координатах (x,y) -void V_dot(short x,short y,unsigned char c); - - -void V_manspr(int x,int y,void *p,unsigned char c); - -void V_manspr2(int x,int y,void *p,unsigned char c); +void V_dot (short x, short y, unsigned char c); +void V_manspr (int x, int y, void *p, unsigned char c); +void V_manspr2 (int x, int y, void *p, unsigned char c); // очистить прямоугольник цветом c // x-левая сторона,w-ширина,y-верх,h-высота -void V_clr(short x,short w,short y,short h,unsigned char c); - -// получить текущую палитру в массив p -void VP_getall(void *p); +void V_clr (short x, short w, short y, short h, unsigned char c); // установить палитру из массива p -void VP_setall(void *p); - -// установить n цветов, начиная с f, из массива p -void VP_set(void *p,short f,short n); - -// заполнить палитру одним цветом (r,g,b) -void VP_fill(char r,char g,char b); - -// приблизить палитру p к цвету (r,g,b) на s/n -// полученная палитра находится в pal_tmp -void VP_tocolor(void *p,char r,char g,char b,char n,char s); - -// приблизить палитру p к палитре p2 на s/n -// полученная палитра находится в pal_tmp -void VP_topal(void *p,void *p2,char n,char s); - -// вывести перемасштабированный к размерам (sx,sy) спрайт i в координатах (x,y) -void VM_spr(short x,short y,short sx,short sy,vgaimg *i); +void VP_setall (void *p); // установить область вывода -void V_setrect(short x,short w,short y,short h); +void V_setrect (short x, short w, short y, short h); // установить адрес экранного буфера // NULL - реальный экран -void V_setscr(void *); +void V_setscr (void *); // скопировать прямоугольник на экран -void V_copytoscr(short x,short w,short y,short h); - -void V_maptoscr(int,int,int,int,void *); - -// вывести символ c -void V_putch(short c); - -// вывести строку s -void V_puts(char *s); - -// вычислить длину строки s (в точках) -short V_strlen(char *s); - -// вычислить ширину символа c (в точках) -short V_chrlen(char c); - -// начать анимацию a -void V_start_anim(void *a); - -// нарисовать кадр анимации -// возвращает номер кадра или 0, если конец -short V_draw_anim(void); - - -// полное описание функций RD_* см. в файле REDRAW.DOC +void V_copytoscr (short x, short w, short y, short h); -// инициализация экрана -void *RD_init(short x,short w,short y,short h); - -// начать перерисовку экрана s при помощи функции f -void RD_start(void *s,redraw_f *f); - -// перерисовать прямоугольник -void RD_rect(short x,short w,short y,short h); - -// перерисовать спрайт -void RD_spr(short x,short y,vgaimg *s); -void RD_spr2(short x,short y,vgaimg *s); - -// окончание перерисовки -void RD_end(void); - - -// возвращает яркость цвета (r,g,b) -short VP_brightness(char r,char g,char b); - -// начать поиск по палитре p, состоящей из n цветов, первый - f -void VP_start_search(rgb_t *p,short n,short f); - -// найти подходящий цвет -short VP_findcolor(short r,short g,short b); +void V_maptoscr (int, int, int, int, void *); // переделать изображение i по карте цветов m -void V_remap(vgaimg *i,colormap m); - - -// загружает палитру p из файла f (VGAED 2.0) -// возвращает 0 при ошибке -short load_pal(char *f,void *p); - -// загружает изображение i из файла f (VGAED 2.0) -// возвращает NULL при ошибке -vgaimg *load_vga(char *f,char *i); - -// загружает анимацию из файла f -// возвращает NULL при ошибке -void *load_anim(char *f); +void V_remap (vgaimg *i, colormap m); -// область вывода -extern short scrw,scrh,scrx,scry; +void V_remap_rect (int x, int y, int w, int h, byte *cmap); -// адрес экранного буфера -extern unsigned char *scra; - -// временная палитра -extern vgapal pal_tmp; - -// ждать ли обратного хода луча при установке палитры -// 0-нет, иначе-да -extern char vp_waitrr; - -// координаты для вывода следующего символа -extern short vf_x,vf_y; - -// расстояние между символами -extern short vf_step; - -// цвет символов -// если 0 - не используется -extern unsigned char vf_color; - -// шрифт -extern void *vf_font; - -// виртуальный экран -extern unsigned char scrbuf[64000]; - -void V_remap_rect(int x,int y,int w,int h,byte *cmap); - -void V_toggle(); +void V_toggle (void); void V_rotspr (int x, int y, vgaimg* i, int d); -void V_center(int f); -void V_offset(int ox, int oy); -extern char fullscreen; - +void V_center (int f); +void V_offset (int ox, int oy); -#ifdef __cplusplus -} -#endif +#endif /* VGA_H_INCLUDED */ diff --git a/src/view.c b/src/view.c index 4e1fce7..1819698 100644 --- a/src/view.c +++ b/src/view.c @@ -23,7 +23,6 @@ #include "glob.h" #include #include -#include "vga.h" #include "memory.h" #include "files.h" #include "error.h" @@ -42,22 +41,14 @@ #include "my.h" #include "render.h" -int WD; -int HT; - -extern map_block_t blk; - byte w_horiz=ON; -int w_o,w_x,w_y,sky_type=1; +int sky_type=1; dword walf[256]; byte walswp[256]; byte fldb[FLDH][FLDW]; byte fldf[FLDH][FLDW]; byte fld[FLDH][FLDW]; -extern int lt_time,lt_type,lt_side,lt_ypos; -extern void *ltn[2][2]; - void W_savegame (FILE* h) { char s[8]; int i; @@ -101,7 +92,7 @@ void W_loadgame (FILE* h) { R_end_load(); } -void W_init(void) { +void W_init (void) { DOT_init(); SMK_init(); FX_init(); @@ -114,7 +105,7 @@ void W_init(void) { free_chunks(); } -static void unpack(void *buf, int len, void *obuf) { +static void unpack (void *buf, int len, void *obuf) { int i = 0; int j = 0; unsigned char *p = buf; diff --git a/src/view.h b/src/view.h index 5f1aad9..33eacd2 100644 --- a/src/view.h +++ b/src/view.h @@ -20,36 +20,11 @@ 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -// View functions - #ifndef VIEW_H_INCLUDED #define VIEW_H_INCLUDED -#include - - -// object data structure -#pragma pack(1) -typedef struct{ - int x,y; // coordinates - int xv,yv; // velocity - int vx,vy; - int r,h; // radius, height -}obj_t; - - -typedef struct{ - int x,y; - byte d; -}pos_t; -#pragma pack() - -enum{HIT_SOME,HIT_ROCKET,HIT_BFG,HIT_TRAP,HIT_WATER,HIT_ELECTRO,HIT_FLAME}; - -enum{ - GS_TITLE,GS_GAME,GS_INTER,GS_DARKEN,GS_ENDANIM,GS_END2ANIM,GS_ENDSCR, - GS_BVIDEO,GS_EVIDEO,GS_END3ANIM -}; +#include "glob.h" +#include // FILE #define FLDW 100 #define FLDH 100 @@ -58,40 +33,45 @@ enum{ #define MAXTXW 16 #define MAXTXH 8 +enum { + HIT_SOME, HIT_ROCKET, HIT_BFG, HIT_TRAP, HIT_WATER, HIT_ELECTRO, HIT_FLAME +}; + +enum { + GS_TITLE, GS_GAME, GS_INTER, GS_DARKEN, GS_ENDANIM, GS_END2ANIM, GS_ENDSCR, + GS_BVIDEO, GS_EVIDEO, GS_END3ANIM +}; + #pragma pack(1) +typedef struct { + int x, y; // coordinates + int xv, yv; // velocity + int vx, vy; + int r, h; // radius, height +} obj_t; + +typedef struct { + int x, y; + byte d; +} pos_t; -typedef struct{ +typedef struct { char n[8]; char t; -}wall_t; - +} wall_t; #pragma pack() +extern byte w_horiz; +extern int sky_type; extern dword walf[256]; extern byte walswp[256]; - -void W_init(void); - -int W_load(FILE*); -int G_load(FILE*); - -void G_init(void); -void G_start(void); -void G_act(void); -void G_draw(void); - -extern byte walswp[256]; -extern byte _2pl,g_dm,g_st,g_exit,w_horiz,g_map; -extern int g_sttm; -extern dword g_time; -extern int w_o,w_x,w_y; extern byte fldb[FLDH][FLDW]; extern byte fldf[FLDH][FLDW]; extern byte fld[FLDH][FLDW]; -extern pos_t dm_pos[]; -extern int dm_pnum,dm_pl1p,dm_pl2p; -extern int WD; // -extern int HT; // +void W_savegame (FILE *h); +void W_loadgame (FILE *h); +void W_init (void); +int W_load (FILE *h); #endif /* VIEW_H_INCLUDED */ diff --git a/src/weapons.c b/src/weapons.c index 34b5ed4..b3b757d 100644 --- a/src/weapons.c +++ b/src/weapons.c @@ -28,19 +28,19 @@ #include "smoke.h" #include "weapons.h" #include "misc.h" +#include "files.h" +#include "game.h" +#include "player.h" +#include "monster.h" +#include "switch.h" #include "my.h" -extern int hit_xv,hit_yv; - -void bfg_fly(int x,int y,int own); - enum{NONE=0,ROCKET,PLASMA,APLASMA,BALL1,BALL2,BALL7,BFGBALL,BFGHIT, MANF,REVF,FIRE}; weapon_t wp[MAXWPN]; static void *snd[14]; - static void throw(int,int,int,int,int,int,int,int); void WP_savegame (FILE *h) { @@ -85,7 +85,7 @@ void WP_loadgame (FILE *h) { } } -void WP_alloc(void) { +void WP_alloc (void) { int i; static char nm[14][6]={ "PISTOL", @@ -106,13 +106,13 @@ void WP_alloc(void) { for(i=0;i<14;++i) snd[i]=Z_getsnd(nm[i]); } -void WP_init(void) { +void WP_init (void) { int i; for(i=0;i // FILE #define MAXWPN 300 #pragma pack(1) -typedef struct{ +typedef struct { obj_t o; - byte t,s; + byte t, s; int own; short target; -}weapon_t; +} weapon_t; #pragma pack() extern weapon_t wp[MAXWPN]; -void WP_init(void); -void WP_alloc(void); -void WP_act(void); -void WP_punch(int,int,int,int); -int WP_chainsaw(int,int,int,int); -void WP_gun(int,int,int,int,int,int); -void WP_pistol(int,int,int,int,int); -void WP_mgun(int,int,int,int,int); -void WP_rocket(int,int,int,int,int); -void WP_revf(int,int,int,int,int,int); -void WP_plasma(int,int,int,int,int); -void WP_ball1(int,int,int,int,int); -void WP_ball2(int,int,int,int,int); -void WP_ball7(int,int,int,int,int); -void WP_aplasma(int,int,int,int,int); -void WP_manfire(int,int,int,int,int); -void WP_bfgshot(int,int,int,int,int); -void WP_bfghit(int,int,int); -void WP_shotgun(int,int,int,int,int); -void WP_dshotgun(int,int,int,int,int); -void WP_ognemet(int x,int y,int xd,int yd,int xv,int yv,int o); - -void WP_grenade(int x, int y, int xd, int yd, int o); +void WP_savegame (FILE *h); +void WP_loadgame (FILE *h); +void WP_alloc (void); +void WP_init (void); +void WP_act (void); +void WP_gun (int x, int y, int xd, int yd, int o, int v); +void WP_punch (int x, int y, int d, int own); +int WP_chainsaw (int x, int y, int d, int own); +void WP_rocket (int x, int y, int xd, int yd, int o); +void WP_revf (int x, int y, int xd, int yd, int o, int t); +void WP_plasma (int x, int y, int xd, int yd, int o); +void WP_ball1 (int x, int y, int xd, int yd, int o); +void WP_ball2 (int x, int y, int xd, int yd, int o); +void WP_ball7 (int x, int y, int xd, int yd, int o); +void WP_aplasma (int x, int y, int xd, int yd, int o); +void WP_manfire (int x, int y, int xd, int yd, int o); +void WP_bfgshot (int x, int y, int xd, int yd, int o); +void WP_bfghit (int x, int y, int o); +void WP_pistol (int x,int y,int xd,int yd,int o); +void WP_mgun (int x, int y, int xd, int yd, int o); +void WP_shotgun (int x, int y, int xd, int yd, int o); +void WP_dshotgun (int x, int y, int xd, int yd, int o); +void WP_ognemet (int x, int y, int xd, int yd, int xv, int yv, int o); + +#endif /* WEAPONS_H_INLUDES */