summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 3d22157)
raw | patch | inline | side by side (parent: 3d22157)
author | DeaDDooMER <deaddoomer@deadsoftware.ru> | |
Sun, 15 Mar 2020 09:20:39 +0000 (12:20 +0300) | ||
committer | DeaDDooMER <deaddoomer@deadsoftware.ru> | |
Sun, 15 Mar 2020 09:20:39 +0000 (12:20 +0300) |
53 files changed:
diff --git a/src/a8.c b/src/a8.c
index 2203b5226ac0fc5e578f840366c5d632e98c7429..855ec1e6f71d2aaccea2deca1941c6d1d37fee9a 100644 (file)
--- a/src/a8.c
+++ b/src/a8.c
#include "error.h"
#include "files.h"
#include "sound.h"
+#include "a8.h"
*/
/*
diff --git a/src/a8.h b/src/a8.h
--- /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 71c44211460b9dc4b93b7ae6bc0e1dd1855f0a39..f68f0a215bd6b930c82e03eaa8425fb8f22de261 100644 (file)
--- a/src/anim.c
+++ b/src/anim.c
#include <vga.h>
//#include <keyb.h>
#include "error.h"
+#include "anim.h"
enum{AB_END,AB_SCREEN,AB_UPDATE};
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
--- /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 ccb44045d3bd976381bb72a1327471409553fb0d..aa63cdbb1f1399705fc74e8020600456fa993173 100644 (file)
--- a/src/bmap.c
+++ b/src/bmap.c
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <stdio.h>
#include "glob.h"
#include "view.h"
#include "bmap.h"
diff --git a/src/bmap.h b/src/bmap.h
index 218c0c7f39efdef4ec7352f63ada5343d21ce8d3..ff53c7aa909ff6dcb3be7db549e3cf1696d6bf79 100644 (file)
--- a/src/bmap.h
+++ b/src/bmap.h
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 9ad78cb2037bc09deb995d76d6258b07fc9f0ff2..0c5bc21868319394f1645d5d800437f29bcb6588 100644 (file)
--- a/src/config.c
+++ b/src/config.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include "config.h"
-//#include "vga.h"
-#include "error.h"
+#include <SDL_keyboard.h>
+#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 <SDL_keyboard.h>
-
-extern byte _warp,fastdraw,nomon;
-extern int mem_chk_sz;
-
enum{NONE,BYTE,WORD,DWORD,STRING,SW_ON,SW_OFF,FILES,KEY};
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},
{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;
}
}
-int get_key(char *name)
-{
+static int get_key (char *name) {
int i;
for(i=1; i<SDLK_LAST; i++) {
char* s = SDL_GetKeyName(i);
diff --git a/src/config.h b/src/config.h
index 4668288dcf25bb8335e980f3d6b3a5a57aea081d..9601b893bc1e17c709f6cece7c7978e21e0130f5 100644 (file)
--- a/src/config.h
+++ b/src/config.h
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-// Configuration
+#ifndef CONFIG_H_INCLUDED
+#define CONFIG_H_INCLUDED
-void CFG_args(int argc, char *argv[]);
-void CFG_load(void);
-void CFG_save(void);
+#include "glob.h"
-extern char cfg_file[];
+extern byte cheat;
+extern byte shot_vga;
+extern char cd_path[128];
+extern char cfg_file[128];
+void CFG_args (int argc, char *argv[]);
+void CFG_load (void);
+void CFG_save (void);
+
+#endif /* CONFIG_H_INCLUDED */
diff --git a/src/dots.c b/src/dots.c
index af54e3a612ad523d940533a34e636635f990164b..b9ca8ec7104913b821402546238821ead00226a9 100644 (file)
--- a/src/dots.c
+++ b/src/dots.c
*/
#include "glob.h"
+#include <stdio.h>
#include <stdlib.h>
#include "view.h"
#include "dots.h"
#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 7229fffbc03b274dc455f34565038ce5dc928798..5a8b75204934b086549e8a4bea4848de82bae1ce 100644 (file)
--- a/src/dots.h
+++ b/src/dots.h
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 <stdio.h> // 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 ef9c388774b7c453b30ffb65dd63be6bb80edfc4..46e5c43cea014cab78405de663aa4c6c7f03958f 100644 (file)
--- a/src/error.c
+++ b/src/error.c
#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 ecb2cc2d763e3ea312736fa123369daacfe8c084..45b2975a827a75e5caaf33f4d64fa6e92f1188fc 100644 (file)
--- a/src/error.h
+++ b/src/error.h
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 f6ef6b5303dd1e740d4875a436ee075581ecdf14..597d149f4cbad222c65e64b1f0e5dcdfc9d12d59 100644 (file)
--- a/src/files.c
+++ b/src/files.c
#include <string.h>
#include <stdlib.h>
#include <sys/stat.h>
-#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
}
}
-void F_addwad(char *fn) {
+void F_addwad (char *fn) {
int i;
for(i=0;i<MAX_WADS;++i) if(wads[i][0]==0) {
ERR_failinit("Не могу добавить WAD %s",fn);
}
-
-int myfilelength(FILE *h)
-{
+static int myfilelength (FILE *h) {
int pos = ftell(h);
fseek (h, 0, SEEK_END);
int len = ftell(h);
return len;
}
-extern void mysplitpath(const char* path, char* drv, char* dir, char* name, char* ext);
-
// build wad directory
void F_initwads (void) {
int i, j, k, p;
// allocate resources
// (called from M_startup)
-void F_allocres(void) {
+void F_allocres (void) {
d_start=F_getresid("D_START");
d_end=F_getresid("D_END");
m_start=F_getresid("M_START");
}
// load resource
-void F_loadres(int r,void *p,dword o,dword l) {
+void F_loadres (int r, void *p, dword o, dword l) {
int oo;
FILE *fh;
}
-
-void F_saveres(int r,void *p,dword o,dword l) {
-
- int oo;
- FILE* fh;
- oo=ftell(fh=wadh[wad[r].f]);
- if(fseek(fh,wad[r].o+o,SEEK_SET)!=0)
+/*
+// unused
+void F_saveres(int r, void *p, dword o, dword l) {
+ FILE* fh = wadh[wad[r].f];
+ int oo = ftell(fh);
+ if (fseek(fh, wad[r].o + o, SEEK_SET) != 0) {
ERR_fatal("Ошибка при чтении файла");
- myfwrite(p,l,1,fh);
- fseek(fh,oo,SEEK_SET);
-
+ }
+ myfwrite(p, l, 1, fh);
+ fseek(fh, oo, SEEK_SET);
}
+*/
// get resource id
-int F_getresid(char *n) {
+int F_findres (char *n) {
int i;
-
- for(i=0;i<wad_num;++i) if(strncasecmp(wad[i].n,n,8)==0) return i;
- ERR_fatal("F_getresid: ресурс %.8s не найден",n);
+ for (i = 0; i < wad_num; i++) {
+ if (strncasecmp(wad[i].n, n, 8) == 0) {
+ return i;
+ }
+ }
return -1;
}
// get resource id
-int F_findres(char *n) {
- int i;
-
- for(i=0;i<wad_num;++i) if(strncasecmp(wad[i].n,n,8)==0) return i;
- return -1;
+int F_getresid (char *n) {
+ int i = F_findres(n);
+ if (i == -1) {
+ ERR_fatal("F_getresid: ресурс %.8s не найден", n);
+ }
+ return i;
}
-void F_getresname(char *n,int r) {
- memcpy(n,wad[r].n,8);
+void F_getresname (char *n, int r) {
+ memcpy(n, wad[r].n, 8);
}
// get sprite id
-int F_getsprid(char n[4],int s,int d) {
+int F_getsprid (char n[4], int s, int d) {
int i;
byte a,b;
return -1;
}
-int F_getreslen(int r) {
+int F_getreslen (int r) {
return wad[r].l;
}
-void F_nextmus(char *s) {
+void F_nextmus (char *s) {
int i;
i=F_findres(s);
if(i<=m_start || i>=m_end) i=m_start;
memcpy(s,wad[i].n,8);
}
-void F_randmus(char *s) {
- int n = myrand(10);
- int i;
- for (i=0; i<n; i++) {
- F_nextmus(s);
- }
+void F_randmus (char *s) {
+ int i;
+ int n = myrand(10);
+ for (i = 0; i < n; i++) {
+ F_nextmus(s);
+ }
}
// reads bytes from file until CR
-void F_readstr(FILE* h, char *s, int m) {
+void F_readstr (FILE* h, char *s, int m) {
int i = 0;
size_t len = 0;
static char c = 0;
s[i] = 0;
}
+/*
+// unused
// reads bytes from file until NUL
-void F_readstrz(FILE* h,char *s,int m) {
+void F_readstrz (FILE* h,char *s,int m) {
int i = 0;
size_t len = 0;
static char c = 0;
}
s[i] = 0;
}
+*/
-map_block_t blk;
-
-void F_loadmap(char n[8]) {
+void F_loadmap (char n[8]) {
int r, o;
FILE *h;
map_header_t hdr;
diff --git a/src/files.h b/src/files.h
index d6b60983402573ffa9f219e54594a890e33891a8..e2d94f0d2183fad644a0310c67b532dd71309f55 100644 (file)
--- a/src/files.h
+++ b/src/files.h
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-// File operations
+#ifndef FILES_H_INCLUDED
+#define FILES_H_INCLUDED
-///#include <io.h>
-//#include <fcntl.h>
-#include <stdio.h>
+#include "glob.h"
+#include <stdio.h> // FILE
+#include "map.h" // map_block_t
#define MAX_WADS 20
#define MAX_WAD 2000
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 35777aca9371d9abf7ba57965722bcc8181e046b..cea21f88d93bef50d403041e64db6865819f00e1 100644 (file)
--- a/src/fx.c
+++ b/src/fx.c
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)
for(i=0;i<SINP;++i) sintab[i]=stdsin[i]*a;
}
-void FX_trans1(int t) {
/*
+void FX_trans1 (int t) {
int x,y,u,v;
static unsigned char k;
unsigned p;
else scra[p]=fx_scr1[v*320+u];
}else scra[p]=fx_scr2[p];
}
-*/
}
+*/
static void init_fx1sin(void) {
int j,r,l,rr;
}
}
-void FX_alloc(void) {
+void FX_alloc (void) {
bsnd[0]=Z_getsnd("BUBL1");
bsnd[1]=Z_getsnd("BUBL2");
init_fx1sin();
}
-void FX_init(void) {
+void FX_init (void) {
int i;
for(i=0;i<MAXFX;++i) fx[i].t=0;
last=0;
}
-void FX_act(void) {
+void FX_act (void) {
int i;
byte b;
}
}
-static int findfree(void) {
+static int findfree (void) {
int i;
for(i=0;i<MAXFX;++i) if(!fx[i].t) return i;
return last;
}
-void FX_tfog(int x,int y) {
+void FX_tfog (int x, int y) {
int i;
i=findfree();
fx[i].x=x;fx[i].y=y;
}
-void FX_ifog(int x,int y) {
+void FX_ifog (int x, int y) {
int i;
i=findfree();
fx[i].x=x;fx[i].y=y;
}
-void FX_bubble(int x,int y,int xv,int yv,int n) {
+void FX_bubble (int x, int y, int xv, int yv, int n) {
int i;
if(!bubsn) {Z_sound(bsnd[rand()&1],128);bubsn=1;}
fx[i].xv=xv;fx[i].yv=yv-myrand(256)-768;
}
}
-
diff --git a/src/fx.h b/src/fx.h
index 3f773b9b893168bdd0cd4d2acc685975384867a1..5d2e4a7d6e44613c3ee2ea729db328001aa1bfa1 100644 (file)
--- a/src/fx.h
+++ b/src/fx.h
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-// Effects
+#ifndef FX_H_INLUDED
+#define FX_H_INLUDED
+
+#include <stdio.h> // 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 4ae9e11fdd949e4f9584b3bf6b51bc6b78d05bbb..8d14674c22ac3f1ebf2c88b1263c4ec4dfe5a8ad 100644 (file)
--- a/src/game.c
+++ b/src/game.c
#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 <SDL_keysym.h>
#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) {
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);
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);
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);
S_startmusic(music_time);
}
-void G_start(void) {
+void G_start (void) {
char s[8];
F_freemus();
#define GGAS_TOTAL (MN__LAST-MN_DEMON+16+10)
-void G_init(void) {
+void G_init (void) {
int i,j;
char s[9];
g_trans=0;
}
-int G_beg_video(void) {
+static int G_beg_video (void) {
/*
switch(g_map) {
case 3: return A8_start("FALL");
}
-int G_end_video(void) {
+static int G_end_video (void) {
/*
switch(g_map) {
case 1: return A8_start("TRUBA");
return 0;
}
-
-void G_act(void) {
+void G_act (void) {
static byte pcnt=0;
/*
if(g_trans) {
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;
#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
--- /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 <stdio.h> // 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 b68f4b662457e4c2ad20bf9e55cd0a21c7146c02..67391c85388b6ab306b471fb357c875459faf8bb 100644 (file)
--- a/src/glob.h
+++ b/src/glob.h
// Globals
-#ifndef MYGLOB
-#define MYGLOB
+#include <stdlib.h>
+
+#ifndef GLOB_H_INCLUDED
+#define GLOB_H_INCLUDED
#ifndef NULL
#define NULL 0
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 <stdio.h>
-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 8918203274c4155ec9123ccd700ead1c0176ad05..49f954bea2177a0deb4a9df38a7eb5e101eed5e9 100644 (file)
--- a/src/items.c
+++ b/src/items.c
#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;
}
}
-void IT_init(void) {
+void IT_init (void) {
int i;
-
- for(i=0;i<MAXITEM;++i) {
- it[i].t=I_NONE;
- it[i].o.xv=it[i].o.yv=it[i].o.vx=it[i].o.vy=0;
+ for (i = 0; i < MAXITEM; ++i) {
+ it[i].t = I_NONE;
+ it[i].o.xv = 0;
+ it[i].o.yv = 0;
+ it[i].o.vx = 0;
+ it[i].o.vy = 0;
}
- tsndtm=rsndtm=0;
+ tsndtm = 0;
+ rsndtm = 0;
}
int IT_load (FILE *h) {
return 0;
}
-static void takesnd(int t) {
+static void takesnd (int t) {
if(tsndtm) return;
t&=0x7FFF;
if(t<=I_CELP || (t>=I_BPACK && t<=I_BFG) || t==I_GUN2)
tsndtm=Z_sound(snd[0],256);
}
-void IT_act(void) {
+void IT_act (void) {
int i,j;
if(tsndtm) --tsndtm;
}
}
-void IT_spawn(int x,int y,int t) {
+void IT_spawn (int x,int y,int t) {
int i;
for(i=0;i<MAXITEM;++i) if(!it[i].t) {
}
}
-void IT_drop_ammo(int t,int n,int x,int y) {
+void IT_drop_ammo (int t, int n, int x, int y) {
static int an[8]={10,4,1,40,50,25,5,100};
int a;
diff --git a/src/items.h b/src/items.h
index 37eace4393b149553f75db38286a3373c38a73c4..bf3bb8a1f6c5e6df034701a6bd68ad5d47c023e4 100644 (file)
--- a/src/items.h
+++ b/src/items.h
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-// Items
+#ifndef ITEMS_H_INCLUDED
+#define ITEMS_H_INCLUDED
-#include <stdio.h>
+#include "view.h" // obj_t
+#include <stdio.h> // 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 4123c071937eac0ee8baab22982c4c38b065b393..71109969491d6a06406decd34204f63b324e1cb3 100644 (file)
--- a/src/keyb.c
+++ b/src/keyb.c
#include "error.h"
#include <SDL.h>
-// стандартная функция обработки клавиш
-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 0684fc5e30c244fdaca4aa666896591c22999111..d52559aba7909143085cb6ba371a5595032de641 100644 (file)
--- a/src/keyb.h
+++ b/src/keyb.h
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 81c257ce0a40d7914b6fb719f22923c53fbbbb01..4b6a9588330d03935a1ca21c6edcb03c64daa8a1 100644 (file)
--- a/src/main.c
+++ b/src/main.c
#include "player.h"
#include "my.h"
#include "render.h"
+#include "game.h"
+#include "music.h"
#include <SDL.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) {
-}
-
-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 5e574a6bb3e9423de6031ca1d9aa54cc35ead70f..e0afb717c85072f27cc39ef43eabc7d8caed93d9 100644 (file)
--- a/src/map.h
+++ b/src/map.h
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#ifndef MAP_H_INCLUDED
+#define MAP_H_INCLUDED
+
#pragma pack(1)
/* Старый формат - версия 1.04 alpha (и раньше)
#pragma pack()
-/* КОНЕЦ */
+#endif /* MAP_H_INCLUDED */
diff --git a/src/memory.c b/src/memory.c
index d3c5e8ccf8364e55b875f59fa472ab986d460fb4..5be719f55d45d1741146a21e3341a5a1d97be3b1 100644 (file)
--- a/src/memory.c
+++ b/src/memory.c
#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));
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<d_end) s=1; else s=0;
}else F_loadres(h,p,0,wad[h].l);
}
-void *M_lock(int h) {
+void *M_lock (int h) {
if(h==-1 || h==0xFFFF) return NULL;
h&=-1-0x8000;
if(h>=MAX_WAD) ERR_fatal("M_lock: странный номер ресурса");
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 84ca70f31e317f67299b6a520873b388615eb58d..191b8b76fa46636f040273a9389003acf5b6b324 100644 (file)
--- a/src/memory.h
+++ b/src/memory.h
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 7d5f374ddff2e0c791c5c5327973ee9f6c997795..bd225a4acace832a199389b15cec09d546973d9c 100644 (file)
--- a/src/menu.c
+++ b/src/menu.c
#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 <SDL.h>
#include <sys/stat.h>
-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;
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;
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) {
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;
}
}
-/*
-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;
{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;
return 0;
}
-static void shot(void) {
+static void shot (void) {
+/*
static int num=1;
char fn[100];//...
#ifndef WIN32
#endif
SDL_SaveBMP(screen, fn);
++num;
+*/
}
-int GM_act(void) {
+int GM_act (void) {
byte c;
if(mnu==&plcolor_mnu) {
return((mnu)?1:0);
}
-void G_keyf(int k, int press) {
+static void G_keyf (int k, int press) {
int i;
lastkey=k;
}
}
-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 ed4a5e994f39d24090f8393b14864ec87adaff00..3e6c65ea619623ea68def234d9a656544fbaf7d7 100644 (file)
--- a/src/menu.h
+++ b/src/menu.h
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];
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 9d81cfa24320219f222a4ad31e0a9c9659848e9e..b48cc3aefa1f1d3d43c4ce8dc090df2d590f7564 100644 (file)
--- a/src/misc.h
+++ b/src/misc.h
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-// Miscellaneous functions
+#ifndef MISC_H_INCLUDED
+#define MISC_H_INCLUDED
-#include <stdint.h>
-#include "view.h"
+#include "glob.h"
+#include "view.h" // obj_t
+#include <stdint.h> // 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 90cfecb9d7bb079e6a8d88e60b999358154bfd5b..1cea2b5f7b0246541f0173cfdf537e5dc286e508 100644 (file)
--- a/src/miscc.c
+++ b/src/miscc.c
#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;
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;
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;
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;
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;
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;
#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;
#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;
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 1357446b1dd45abbffc46d0ee6709d2fd2c8a467..e895a3827709675ab06c0b93361e1d26f4a89222 100644 (file)
--- a/src/monster.c
+++ b/src/monster.c
#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",
"","U","U","U","","T","","","","","","","","","","","","","","W"
};
-int hit_xv,hit_yv;
+int hit_xv, hit_yv;
mn_t mn[MAXMN];
static void *fsnd,*pauksnd,*trupsnd;
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--) {
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);
#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"},
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;i<MAXMN;++i) {mn[i].t=0;mn[i].st=SLEEP;}
gsndt=mnum=0;
}
-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;
-}
-
-int MN_spawn(int x,int y,byte d,int t) {
+int MN_spawn (int x, int y, byte d, int t) {
int i;
if(g_dm && nomon && t<MN_PL_DEAD) return -1;
return i;
}
-int MN_spawn_deadpl(obj_t *o,byte c,int t) {
+int MN_spawn_deadpl (obj_t *o, byte c, int t) {
int i;
if((i=MN_spawn(o->x,o->y,c,t+MN_PL_DEAD))==-1) return -1;
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) if(mn[i].t && mn[i].st!=DEAD)
return -3;
}
-void MN_act(void) {
+static int Z_hitobj (int obj, int d, int own, int t) {
+ hit_xv=hit_yv=0;
+ if(obj==-1) return PL_hit(&pl1,d,own,t);
+ else if(obj==-2 && _2pl) return PL_hit(&pl2,d,own,t);
+ else if(obj<0 || obj>=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;
}
}
-void MN_mark(void) {
+void MN_mark (void) {
int i;
for(i=0;i<MAXMN;++i) if(mn[i].t!=0) BM_mark(&mn[i].o,BM_MONSTER);
}
#define hit(o,x,y) (y<=o.y && y>o.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))
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;
return 0;
}
-void MN_killedp(void) {
+void MN_killedp (void) {
int i;
-
for(i=0;i<MAXMN;++i) if(mn[i].t==MN_MAN)
if(mn[i].st!=DEAD && mn[i].st!=DIE && mn[i].st!=SLEEP)
Z_sound(trupsnd,128);
}
-int Z_hitobj(int obj,int d,int own,int t) {
- hit_xv=hit_yv=0;
- if(obj==-1) return PL_hit(&pl1,d,own,t);
- else if(obj==-2 && _2pl) return PL_hit(&pl2,d,own,t);
- else if(obj<0 || obj>=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;
}
}
-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;
}
}
-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;
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;
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<MAXMN;++i) if(mn[i].t && mn[i].t!=MN_CACO && mn[i].t!=MN_SOUL
diff --git a/src/monster.h b/src/monster.h
index 7b822f624739b7022f4c8fc13ee4bf4fdcaad732..98534b3f21739ac530842ab720573435d055617c 100644 (file)
--- a/src/monster.h
+++ b/src/monster.h
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-// Monsters
+#ifndef MONSTER_H_INLUDED
+#define MONSTER_H_INLUDED
+
+#include "glob.h"
+#include "view.h" // obj_t
#define MAXMN 200
-enum{
- MN_NONE,MN_DEMON,MN_IMP,MN_ZOMBY,MN_SERG,MN_CYBER,MN_CGUN,
- MN_BARON,MN_KNIGHT,MN_CACO,MN_SOUL,MN_PAIN,MN_SPIDER,MN_BSP,
- MN_MANCUB,MN_SKEL,MN_VILE,MN_FISH,MN_BARREL,MN_ROBO,MN_MAN,
+enum {
+ MN_NONE, MN_DEMON, MN_IMP, MN_ZOMBY, MN_SERG, MN_CYBER, MN_CGUN,
+ MN_BARON, MN_KNIGHT, MN_CACO, MN_SOUL, MN_PAIN, MN_SPIDER, MN_BSP,
+ MN_MANCUB, MN_SKEL, MN_VILE, MN_FISH, MN_BARREL, MN_ROBO, MN_MAN,
MN__LAST,
- MN_PL_DEAD=100,MN_PL_MESS
+ MN_PL_DEAD = 100,
+ MN_PL_MESS
};
#define MN_TN (MN__LAST-MN_DEMON)
#pragma pack(1)
-typedef struct{
+typedef struct {
obj_t o;
- byte t,d,st,ftime;
+ byte t, d, st, ftime;
int fobj;
int s;
char *ap;
- int aim,life,pain,ac,tx,ty,ammo;
+ int aim, life, pain, ac, tx, ty, ammo;
short atm;
-}mn_t;
+} mn_t;
#pragma pack(0)
+extern byte nomon;
+extern int hit_xv, hit_yv;
extern mn_t mn[MAXMN];
-void MN_init(void);
-void MN_alloc(void);
-int MN_spawn(int,int,byte,int);
-int MN_spawn_deadpl(obj_t *,byte,int);
-void MN_act(void);
-void MN_mark(void);
-void MN_warning(int l,int t,int r,int b);
+void MN_savegame (FILE *h);
+void MN_loadgame (FILE *h);
+void MN_alloc (void);
+void MN_init (void);
+int MN_spawn (int x, int y, byte d, int t);
+int MN_spawn_deadpl (obj_t *o, byte c, int t);
+int Z_getobjpos (int i, obj_t *o);
+void MN_act (void);
+void MN_mark (void);
+int MN_hit (int n, int d, int o, int t);
+int Z_gunhit (int x, int y, int o, int xv, int yv);
+int Z_hit (obj_t *o, int d, int own, int t);
+void MN_killedp (void);
+void Z_explode (int x, int y, int rad, int own);
+void Z_bfg9000 (int x, int y, int own);
+int Z_chktrap (int t, int d, int o, int ht);
+void Z_teleobj (int o, int x, int y);
+void MN_warning (int l, int t, int r, int b);
-void MN_killedp(void);
+#endif /* MONSTER_H_INLUDED */
diff --git a/src/music.c b/src/music.c
index 4dc87c295fbfc66a3569e70939577c83772c4dac..ddd74b03c90dc56c60b8bfa041de81a102278839 100644 (file)
--- a/src/music.c
+++ b/src/music.c
*/
#include "glob.h"
-#include "sound.h"
#include "files.h"
+#include "music.h"
+#include "error.h"
+#include "game.h"
#include <SDL.h>
#include <SDL_mixer.h>
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());
S_volumemusic(mus_vol);
}
-void S_donemusic(void)
-{
+void S_donemusic (void) {
if (SDL_WasInit(SDL_INIT_AUDIO)) {
F_freemus();
Mix_CloseAudio();
}
}
-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;
}
}
-struct {
+static struct {
Uint8 ascii;
Uint8 asciilc;
char *ch;
{0}
};
-char *get_trans_char (Uint8 c)
+static char *get_trans_char (Uint8 c)
{
int i = 0;
while (atrans[i].ascii) {
return NULL;
}
-void trans_ascii_str (char *dest, char *src)
+static void trans_ascii_str (char *dest, char *src)
{
char *p = dest;
int i;
*p='\0';
}
-void F_loadmus(char n[8]) {
+void F_loadmus (char n[8]) {
if (musdisabled) return;
char f[50];
char name[50];
}
-void F_freemus(void) {
+void F_freemus (void) {
if (musdisabled) return;
if (muslo) {
Mix_HaltMusic();
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
--- /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 bfae25f516d150ccbf2edd38e3af7eaea89ac493..a966eb8b697aab420f65e938f0d924865ec25497 100644 (file)
--- a/src/my.c
+++ b/src/my.c
#include <stdint.h>
#include <assert.h>
-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 */
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")))
{
return 1;
}
return 0;
-}
\ No newline at end of file
+}
diff --git a/src/my.h b/src/my.h
index f52be8b093009b1de67e6161b7ee479900b221cd..15792f1f9adbe96cd209d6719efd88fd86f817d2 100644 (file)
--- a/src/my.h
+++ b/src/my.h
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#ifdef __cplusplus
-extern "C" {
-#endif
+#ifndef MY_H_INCLUDED
+#define MY_H_INCLUDED
-#include <stdio.h>
-#include <stdint.h>
+#include <stdint.h> // int16_t int32_t
+#include <stdio.h> // 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 7a693ac959eb2829f5bb0166e194f7e452b063da..f593f3071d19b0fa691ed3302f4b12d3a17a6c76 100644 (file)
--- a/src/player.c
+++ b/src/player.c
#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
#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)
} _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);
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);
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;
}
}
-int PL_isdead(player_t *p) {
+int PL_isdead (player_t *p) {
switch(p->st) {
case DEAD: case MESS:
case OUT:
return 0;
}
-void PL_init(void) {
+void PL_init (void) {
p_immortal=0;
PL_JUMP=10;PL_RUN=8;
aitime=0;
}
}
-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;
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:
return 1;
}
-void PL_damage(player_t *p) {
+void PL_damage (player_t *p) {
int i;
if(!p->hit && p->life>0) return;
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) {
}
}
-void PL_act(player_t *p) {
+void PL_act (player_t *p) {
int st;
if(--aitime<0) aitime=0;
}
}
-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 2ddb96f9e9b67e3c48fb39821e14029a531f92a2..db4f992250f10d0e141008a150fb383ab1e7cc5e 100644 (file)
--- a/src/player.h
+++ b/src/player.h
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 <stdio.h> // FILE
#define PL_DRAWLIFE 1
#define PL_DRAWARMOR 2
#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;
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 254b87eb6b8e4f907778af90bcd372781adfc4bb..b0f2485ac1a3d4b07c15b309d8109e64164b2ebd 100644 (file)
--- a/src/render.c
+++ b/src/render.c
#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
};
// 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];
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) {
}
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 9226e995499b5f08e7e1bb4aade8cf3028b2077e..71d4365f659451e0b2ae2d329fdd72548e9c6eec 100644 (file)
--- a/src/render.h
+++ b/src/render.h
+#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);
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 6ccb15a11511c6ad9297cd09d67cdd821ce3e927..19bf714fb4f5393a7bdd4c5081dc026d6fcdcfc5 100644 (file)
--- a/src/smoke.c
+++ b/src/smoke.c
#include <stdlib.h>
#include "view.h"
#include "smoke.h"
+#include "game.h"
#include "fx.h"
#include "misc.h"
#include "my.h"
+#include "monster.h"
#define MAXSR 20
}
}
-void SMK_init(void) {
+void SMK_init (void) {
int i;
for(i=0;i<MAXSMOK;++i) {sm[i].t=0;}
burntm=0;
}
-void SMK_alloc(void) {
+void SMK_alloc (void) {
int i;
burnsnd=Z_getsnd("BURN");
for(i=0;i<MAXSR;++i) {
if(++lsm>=MAXSMOK) lsm=0;
}
-void SMK_act(void) {
+void SMK_act (void) {
int i,ox,oy;
static obj_t o;
}
}
-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;
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;
}
}
-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 1f33f1da490b788c28a839c3142d4e2e90dfafe1..8ba0a0f36de8351e9b8ed259ff7a3f75a43178ec 100644 (file)
--- a/src/smoke.h
+++ b/src/smoke.h
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-// Smoke
+#ifndef SMOKE_H_INLUDED
+#define SMOKE_H_INLUDED
+
+#include "glob.h"
+#include <stdio.h> // FILE
#define MAXSMOK 500
#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 de334340c50f820be2065c5339790bd586cae71e..2fe510b4115479f815d32e3a4d347df286dc9989 100644 (file)
--- a/src/sound.c
+++ b/src/sound.c
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());
S_volume(snd_vol);
}
-void S_done(void)
-{
+void S_done (void) {
free_chunks();
if (SDL_WasInit(SDL_INIT_AUDIO)) {
Mix_CloseAudio();
}
}
-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; i<NUM_CHUNKS; i++) {
if (chunks[i].s == s) return chunks[i].c;
return chunk;
}
-void free_chunks()
-{
+void free_chunks (void) {
if (snddisabled) return;
Mix_HaltChannel(-1);
int i;
}
}
-short S_play(snd_t *s,short c,unsigned r,short v)
-{
+short S_play(snd_t *s, short c, unsigned r, short v) {
if (snddisabled) return 0;
Mix_Chunk *chunk = get_chunk(s,r,v);
if (chunk==NULL) return 0;
return Mix_PlayChannel(c, chunk, 0);
}
-void S_stop(short c)
-{
+void S_stop (short c) {
Mix_HaltChannel(c);
}
-void S_volume(int v)
-{
+void S_volume (int v) {
if (snddisabled) return;
snd_vol=v;
if (snd_vol>128) snd_vol=128;
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 dc46f7c6538cf8a954984b9d67ea7dd7ed808b42..5f71e34bddb486e3968e5d9856f04e381a22c282 100644 (file)
--- a/src/sound.h
+++ b/src/sound.h
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 a04650889c04feace9571f39701ae9ac0a8a1a51..b04c3033119b5c81ba7480b07829fe21f69a125c 100644 (file)
--- a/src/switch.c
+++ b/src/switch.c
#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;
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");
sndnotele=Z_getsnd("NOTELE");
}
-void SW_init(void) {
+void SW_init (void) {
int i;
-
- for(i=0;i<MAXSW;++i) sw[i].t=0;
- swsnd=0;
+ for (i = 0; i < MAXSW; i++) {
+ sw[i].t = 0;
+ }
+ swsnd = 0;
}
-static byte cht,chto,chf,f_ch;
-
static void door(byte x,byte y) {
byte ex;
}
}
-void Z_water_trap(obj_t *o) {
+void Z_water_trap (obj_t *o) {
int i,j,sx,sy,x,y;
if((y=o->y)>=FLDH*CELH+o->h) return;
}
}
-void Z_untrap(byte t) {
+void Z_untrap (byte t) {
byte *p;
word n;
return 1;
}
-void SW_act(void) {
+void SW_act (void) {
int i;
if(swsnd) --swsnd;
return 0;
}
-void SW_cheat_open(void) {
+void SW_cheat_open (void) {
int i;
for(i=0;i<MAXSW;++i) if(sw[i].t && !sw[i].tm) switch(sw[i].t) {
}
}
-int SW_press(int x,int y,int r,int h,byte t,int o) {
+int SW_press (int x, int y, int r, int h, byte t, int o) {
int sx,sy,i,p;
sx=(x-r)/CELW;sy=(y-h+1)/CELH;
diff --git a/src/switch.h b/src/switch.h
index 222b1a0195d271c3489f3e73ef76060d04184ef6..621df40eb687468efa78238593f81300509c6c5f 100644 (file)
--- a/src/switch.h
+++ b/src/switch.h
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-// Switches
+#ifndef SWITCH_H_INCLUDED
+#define SWITCH_H_INCLUDED
-#include <stdio.h>
+#include <stdio.h> // 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 0d16859efde217bd07cc56e0da4dfda6a726744a..8347b3ae55c0400becdbd67cb796e6d6b8ad60fe 100644 (file)
--- a/src/vga.c
+++ b/src/vga.c
// адрес экранного буфера
-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
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);
}
// переключение в текстовый режим
-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;
}
// установить область вывода
-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;
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;
}
}
-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;
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;
}
}
-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;
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;
}
}
-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;
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; cx<x+w; cx++)
for (cy=y; cy<y+h; cy++)
V_copytoscr(x,w,y,h);
}
-void V_remap_rect(int x,int y,int w,int h,byte *cmap)
-{
+void V_remap_rect (int x, int y, int w, int h, byte *cmap) {
int cx,cy;
for (cx=x; cx<x+w; cx++)
for (cy=y; cy<y+h; cy++)
mappixel(cx,cy,cmap);
}
-void V_toggle()
-{
+void V_toggle (void) {
if (!SDL_WM_ToggleFullScreen(screen)) {
int ncolors = screen->format->palette->ncolors;
SDL_Color colors[256];
diff --git a/src/vga.h b/src/vga.h
index 48392c20ce7c3c0b1f59fd4bd7fd455c1ccfe6f2..44f1d485b0b749cc3bc09206b84f0eb1970277c3 100644 (file)
--- a/src/vga.h
+++ b/src/vga.h
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 4e1fce7858c3cac07379f56376d3d304062d0fe4..18196984a49fff3acc5aaf33351195f7630584b0 100644 (file)
--- a/src/view.c
+++ b/src/view.c
#include "glob.h"
#include <string.h>
#include <stdlib.h>
-#include "vga.h"
#include "memory.h"
#include "files.h"
#include "error.h"
#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;
R_end_load();
}
-void W_init(void) {
+void W_init (void) {
DOT_init();
SMK_init();
FX_init();
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 5f1aad947d8cc55f949f76ac62a7400925a5a6c0..33eacd2f4a717ffbada6dc51653297c6f5d763de 100644 (file)
--- a/src/view.h
+++ b/src/view.h
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-// View functions
-
#ifndef VIEW_H_INCLUDED
#define VIEW_H_INCLUDED
-#include <stdio.h>
-
-
-// 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 <stdio.h> // FILE
#define FLDW 100
#define FLDH 100
#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 34b5ed4a1a7f25f49bc3e8467c0a62b8d03c2fcd..b3b757dc11724122aefce6874e89f6074a199b8f 100644 (file)
--- a/src/weapons.c
+++ b/src/weapons.c
#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) {
}
}
-void WP_alloc(void) {
+void WP_alloc (void) {
int i;
static char nm[14][6]={
"PISTOL",
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<MAXWPN;++i) wp[i].t=NONE;
}
-void WP_act(void) {
+void WP_act (void) {
int i,st;
static obj_t o;
}
}
-void WP_gun(int x,int y,int xd,int yd,int o,int v) {
+void WP_gun (int x, int y, int xd, int yd, int o, int v) {
register dword d,m;
int sx,sy,lx,ly;
dword xe,ye,s;
}
}
-void WP_punch(int x,int y,int d,int own) {
+void WP_punch (int x, int y, int d, int own) {
obj_t o;
o.x=x;o.y=y;o.r=12;o.h=26;
if(Z_hit(&o,d,own,HIT_SOME)) Z_sound(snd[9],128);
}
-int WP_chainsaw(int x,int y,int d,int own) {
+int WP_chainsaw (int x, int y, int d, int own) {
obj_t o;
o.x=x;o.y=y;o.r=12;o.h=26;
wp[i].o.vx=wp[i].o.vy=0;
}
-void WP_rocket(int x,int y,int xd,int yd,int o) {
+void WP_rocket (int x, int y, int xd, int yd, int o) {
int i;
for(i=0;i<MAXWPN;++i) if(!wp[i].t) {
}
}
-void WP_revf(int x,int y,int xd,int yd,int o,int t) {
+void WP_revf (int x, int y, int xd, int yd, int o, int t) {
int i;
for(i=0;i<MAXWPN;++i) if(!wp[i].t) {
}
}
-void WP_plasma(int x,int y,int xd,int yd,int o) {
+void WP_plasma (int x, int y, int xd, int yd, int o) {
int i;
for(i=0;i<MAXWPN;++i) if(!wp[i].t) {
}
}
-void WP_ball1(int x,int y,int xd,int yd,int o) {
+void WP_ball1 (int x, int y, int xd, int yd, int o) {
int i;
for(i=0;i<MAXWPN;++i) if(!wp[i].t) {
}
}
-void WP_ball2(int x,int y,int xd,int yd,int o) {
+void WP_ball2 (int x, int y, int xd, int yd, int o) {
int i;
for(i=0;i<MAXWPN;++i) if(!wp[i].t) {
}
}
-void WP_ball7(int x,int y,int xd,int yd,int o) {
+void WP_ball7 (int x, int y, int xd, int yd, int o) {
int i;
for(i=0;i<MAXWPN;++i) if(!wp[i].t) {
}
}
-void WP_aplasma(int x,int y,int xd,int yd,int o) {
+void WP_aplasma (int x, int y, int xd, int yd, int o) {
int i;
for(i=0;i<MAXWPN;++i) if(!wp[i].t) {
}
}
-void WP_manfire(int x,int y,int xd,int yd,int o) {
+void WP_manfire (int x, int y, int xd, int yd, int o) {
int i;
for(i=0;i<MAXWPN;++i) if(!wp[i].t) {
}
}
-void WP_bfgshot(int x,int y,int xd,int yd,int o) {
+void WP_bfgshot (int x, int y, int xd, int yd, int o) {
int i;
for(i=0;i<MAXWPN;++i) if(!wp[i].t) {
}
}
-void WP_bfghit(int x,int y,int o) {
+void WP_bfghit (int x, int y, int o) {
int i;
for(i=0;i<MAXWPN;++i) if(!wp[i].t) {
}
}
-void WP_pistol(int x,int y,int xd,int yd,int o) {
+void WP_pistol (int x,int y,int xd,int yd,int o) {
Z_sound(snd[0],96);
WP_gun(x,y,xd,yd,o,1);
if(g_dm) {
}
}
-void WP_mgun(int x,int y,int xd,int yd,int o) {
+void WP_mgun (int x, int y, int xd, int yd, int o) {
Z_sound(snd[11],128);
WP_gun(x,y,xd,yd,o,1);
}
-void WP_shotgun(int x,int y,int xd,int yd,int o) {
+void WP_shotgun (int x, int y, int xd, int yd, int o) {
int i,j;
Z_sound(snd[1],128);
}
}
-void WP_dshotgun(int x,int y,int xd,int yd,int o) {
+void WP_dshotgun (int x, int y, int xd, int yd, int o) {
int i,j;
Z_sound(snd[2],128);
}
}
-void WP_ognemet(int x,int y,int xd,int yd,int xv,int yv,int o) {
+void WP_ognemet (int x, int y, int xd, int yd, int xv, int yv, int o) {
int m;
m=abs(xd-x);if(!m) m=abs(yd-y);
diff --git a/src/weapons.h b/src/weapons.h
index b31593c1945a6d336636074dbd87e98dcb578ca4..0939b317becccc2184ce4c0cf63591cb386b65c2 100644 (file)
--- a/src/weapons.h
+++ b/src/weapons.h
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-// Weapons
+#ifndef WEAPONS_H_INLUDED
+#define WEAPONS_H_INLUDED
+
+#include <stdio.h> // 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 */