diff --git a/src/items.c b/src/items.c
index c9b23b5f7370a6a466fde5cf873b9fe2fb7e0644..49f954bea2177a0deb4a9df38a7eb5e101eed5e9 100644 (file)
--- a/src/items.c
+++ b/src/items.c
#include "misc.h"
#include "map.h"
#include "my.h"
#include "misc.h"
#include "map.h"
#include "my.h"
+#include "files.h"
+#include "game.h"
+item_t it[MAXITEM];
-extern map_block_t blk;
+static void *snd[4];
+static int tsndtm, rsndtm;
-#pragma pack(1)
-typedef struct{
- obj_t o;
- int t;
- int s;
-}item_t;
-#pragma pack()
-
-static void *snd[4],*spr[58];
-static char sprd[58];
-static int tsndtm,rsndtm;
-static item_t it[MAXITEM];
-
-int itm_rtime=1092;
+int itm_rtime = 1092;
void IT_savegame (FILE *h) {
int i, n;
void IT_savegame (FILE *h) {
int i, n;
itm_rtime = myfread32(h);
}
itm_rtime = myfread32(h);
}
-void IT_alloc(void) {
- int i,j,n;
- static char nm[][6]={
- "ITEMUP","WPNUP","GETPOW","ITMBK"
- },snm[][4]={
- "CLIP","SHEL","ROCK","CELL","AMMO","SBOX","BROK","CELP",
- "STIM","MEDI","BPAK",
- "CSAW","SHOT","SGN2","MGUN","LAUN","PLAS","BFUG"
- },n4[][4]={
- "SOUL","SMRT","SMGT","SMBT"
- },n3[][4]={
- "GOR1","FCAN"
+void IT_alloc (void) {
+ int i, j, n;
+ static char nm[][6] = {
+ "ITEMUP", "WPNUP", "GETPOW", "ITMBK"
};
};
-
-// logo(" items");
- for(i=0;i<18;++i) spr[i]=Z_getspr(snm[i],0,0,sprd+i);
- for(;i<20;++i) {
- spr[i]=Z_getspr("ARM1",i-18,0,sprd+i);
- spr[i+2]=Z_getspr("ARM2",i-18,0,sprd+i);
- }i+=2;
- for(;i<26;++i) spr[i]=Z_getspr("MEGA",i-22,0,sprd+i);
- for(;i<30;++i) spr[i]=Z_getspr("PINV",i-26,0,sprd+i);
- spr[30]=Z_getspr("AQUA",0,0,sprd+30);
- spr[31]=Z_getspr("KEYR",0,0,sprd+31);
- spr[32]=Z_getspr("KEYG",0,0,sprd+32);
- spr[33]=Z_getspr("KEYB",0,0,sprd+33);
- spr[34]=Z_getspr("SUIT",0,0,sprd+34);
- for(n=35,j=0;j<4;++j)
- for(i=0;i<4;++i,++n) spr[n]=Z_getspr(n4[j],i,0,sprd+n);
- for(j=0;j<2;++j)
- for(i=0;i<3;++i,++n) spr[n]=Z_getspr(n3[j],i,0,sprd+n);
- spr[57]=Z_getspr("GUN2",0,0,sprd+57);
- for(i=0;i<4;++i) snd[i]=Z_getsnd(nm[i]);
- for(i=0;i<MAXITEM;++i) {it[i].o.r=10;it[i].o.h=8;}
+ for (i = 0; i < 4; ++i) {
+ snd[i] = Z_getsnd(nm[i]);
+ }
+ for (i = 0; i < MAXITEM; ++i) {
+ it[i].o.r = 10;
+ it[i].o.h = 8;
+ }
}
}
-void IT_init(void) {
+void IT_init (void) {
int i;
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) {
}
int IT_load (FILE *h) {
return 0;
}
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)
if(tsndtm) return;
t&=0x7FFF;
if(t<=I_CELP || (t>=I_BPACK && t<=I_BFG) || t==I_GUN2)
tsndtm=Z_sound(snd[0],256);
}
tsndtm=Z_sound(snd[0],256);
}
-void IT_act(void) {
+void IT_act (void) {
int i,j;
if(tsndtm) --tsndtm;
int i,j;
if(tsndtm) --tsndtm;
}
}
}
}
-void IT_draw(void) {
- int i,s;
-
- for(i=0;i<MAXITEM;++i) {
- s=-1;
- if(it[i].t && it[i].s>=0) switch(it[i].t&0x7FFF) {
- case I_ARM1:
- s=it[i].s/9+18;break;
- case I_ARM2:
- s=it[i].s/9+20;break;
- case I_MEGA:
- s=it[i].s/2+22;break;
- case I_INVL:
- s=it[i].s/2+26;break;
- case I_SUPER: case I_RTORCH: case I_GTORCH: case I_BTORCH:
- s=it[i].s/2+(it[i].t-I_SUPER)*4+35;break;
- case I_GOR1: case I_FCAN:
- s=it[i].s/2+(it[i].t-I_GOR1)*3+51;break;
- case I_AQUA: s=30;break;
- case I_SUIT: s=34;break;
- case I_KEYR: case I_KEYG: case I_KEYB:
- s=(it[i].t&0x7FFF)-I_KEYR+31;break;
- case I_GUN2: s=57;break;
- default:
- s=(it[i].t&0x7FFF)-1;
- }
- if(s>=0) Z_drawspr(it[i].o.x,it[i].o.y,spr[s],sprd[s]);
- }
-}
-
-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) {
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;
static int an[8]={10,4,1,40,50,25,5,100};
int a;