Skip to content

Commit 696847a

Browse files
author
Marek
committed
New weapon - bloodrain
1 parent b99f2f7 commit 696847a

17 files changed

+208
-111
lines changed

client.c

+18-6
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ struct it* hero;
128128
int hit_sprite;
129129
int title_sprite;
130130
int bulge_sprite;
131-
int shrapnel_sprite[N_SHRAPNELS],bfgbit_sprite[N_SHRAPNELS];
131+
int shrapnel_sprite[N_SHRAPNELS],bfgbit_sprite[N_SHRAPNELS],bloodrain_sprite[N_SHRAPNELS];
132132

133133
int level_sprites_start; /* number of first sprite in the level (all other level sprites follow) */
134134

@@ -570,12 +570,13 @@ int contact_server(struct config *cfg)
570570
armor=0;
571571
for(a=0;a<ARMS;a++)
572572
ammo[a]=0;
573-
ammo[0]=weapon[0].basic_ammo;
574-
ammo[6]=1;
573+
ammo[WEAPON_GUN]=weapon[WEAPON_GUN].basic_ammo;
574+
ammo[WEAPON_CHAINSAW]=weapon[WEAPON_CHAINSAW].basic_ammo;
575575
current_weapon=0;
576576
weapons=WEAPON_MASK_GUN |
577577
WEAPON_MASK_GRENADE |
578-
WEAPON_MASK_CHAINSAW; /* gun and grenades */
578+
WEAPON_MASK_CHAINSAW |
579+
WEAPON_MASK_BLOODRAIN; /* gun, grenades, chainsaw and blodrain */
579580
hero=new_obj(
580581
get_int(packet+1), /* ID */
581582
T_PLAYER, /* type */
@@ -1382,6 +1383,7 @@ int process_packet(char *packet,int l)
13821383

13831384
case P_EXPLODE_GRENADE:
13841385
case P_EXPLODE_BFG:
1386+
case P_EXPLODE_BLOODRAIN:
13851387
{
13861388
unsigned int i,j;
13871389
struct object_list *p;
@@ -1405,7 +1407,9 @@ int process_packet(char *packet,int l)
14051407
SHRAPNEL_TTL,
14061408
(*packet==P_EXPLODE_GRENADE)?
14071409
shrapnel_sprite[random()%N_SHRAPNELS]:
1408-
bfgbit_sprite[random()%N_SHRAPNELS],
1410+
(*packet==P_EXPLODE_BFG)?
1411+
bfgbit_sprite[random()%N_SHRAPNELS]:
1412+
bloodrain_sprite[random()%N_SHRAPNELS],
14091413
0,
14101414
WEAPON_GRENADE,
14111415
p->member.x,
@@ -1415,7 +1419,8 @@ int process_packet(char *packet,int l)
14151419
0);
14161420
i++;
14171421
}
1418-
delete_obj(j);
1422+
if (*packet != P_EXPLODE_BLOODRAIN)
1423+
delete_obj(j);
14191424

14201425
}
14211426
break;
@@ -2197,6 +2202,8 @@ void play(void)
21972202
keyboard_status.weapon=6;
21982203
if (!chat && c_was_pressed('7'))
21992204
keyboard_status.weapon=7;
2205+
if (!chat && c_was_pressed('8'))
2206+
keyboard_status.weapon=8;
22002207
if (c_pressed(K_LEFT_SHIFT)||c_pressed(K_RIGHT_SHIFT)||autorun)
22012208
keyboard_status.speed=1;
22022209
if (c_pressed(K_LEFT))
@@ -2264,6 +2271,11 @@ int main(int argc,char **argv)
22642271
fprintf(stderr,"Can't find sprite \"%s\".\n",txt);
22652272
EXIT(1);
22662273
}
2274+
snprintf(txt, sizeof(txt), "bloodrain%d",a+1);
2275+
if (find_sprite(txt,&bloodrain_sprite[a])) {
2276+
fprintf(stderr,"Can't find sprite \"%s\".\n",txt);
2277+
EXIT(1);
2278+
}
22672279
}
22682280

22692281
signal(SIGINT,signal_handler);

data.c

+32-55
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ struct weapon_type weapon[ARMS]=
8585
{"Grenades",15,60,float2double((double)3.73*36),0,75,40,0,6,24,float2double(3*36),-float2double((double)1.5*36)}, /* shell speed=grenade throwing speed, bullet speed=shrapnel speed */
8686
{"BFG",200,80,float2double(2*36),float2double(1*36),100,100,10,10,10,float2double((double).1*36),-float2double((double)1.5*36)},
8787
{"Chainsaw",1,5,float2double(1.8*36),0,10,10,1,1,1,0,0},
88+
{"Bloodrain",15,0,float2double((double)3.73*36),0,75,40,1,1,1,0,0},
8889
};
8990

9091

@@ -137,64 +138,40 @@ int find_sprite(char *name,int *num)
137138
/* convert type character (from data files) into type */
138139
int _convert_type(unsigned char c)
139140
{
140-
switch(c)
141-
{
142-
141+
switch(c) {
143142
/* static objects */
144-
case 'b': return TYPE_BACKGROUND;
145-
146-
case 'w': return TYPE_WALL;
147-
148-
case 'j': return TYPE_JUMP;
149-
150-
case 'f': return TYPE_FOREGROUND;
151-
152-
case 'i': return TYPE_JUMP_FOREGROUND;
143+
case 'b': return TYPE_BACKGROUND;
144+
case 'w': return TYPE_WALL;
145+
case 'j': return TYPE_JUMP;
146+
case 'f': return TYPE_FOREGROUND;
147+
case 'i': return TYPE_JUMP_FOREGROUND;
153148

154149
/* dynamic objects, they use great letter */
155-
156-
case 'M': return T_MEDIKIT;
157-
158-
case 'A': return T_ARMOR;
159-
160-
case 'N': return T_NOTHING;
161-
162-
case 'F': return T_NOTHING_FORE;
163-
164-
case 'K': return T_KILL;
165-
166-
case 'S': return T_SHOTGUN;
167-
168-
case 'Z': return T_BFG;
169-
170-
case 'U': return T_UZI;
171-
172-
case 'R': return T_RIFLE;
173-
174-
case '1': return T_AMMO_GUN;
175-
176-
case '2': return T_AMMO_SHOTGUN;
177-
178-
case '3': return T_AMMO_UZI;
179-
180-
case '4': return T_AMMO_RIFLE;
181-
182-
case '5': return T_AMMO_GRENADE;
183-
184-
case 'I': return T_INVISIBILITY;
185-
186-
case 'T': return T_TELEPORT;
187-
188-
case 'X': return T_BIOSKULL;
189-
190-
case 'x': return T_BIOMED;
191-
192-
/* birthplace */
193-
case 'B': return TYPE_BIRTHPLACE;
194-
195-
default:
196-
return -1;
197-
}
150+
case 'M': return T_MEDIKIT;
151+
case 'A': return T_ARMOR;
152+
case 'N': return T_NOTHING;
153+
case 'F': return T_NOTHING_FORE;
154+
case 'K': return T_KILL;
155+
case 'S': return T_SHOTGUN;
156+
case 'Z': return T_BFG;
157+
case 'U': return T_UZI;
158+
case 'R': return T_RIFLE;
159+
case '1': return T_AMMO_GUN;
160+
case '2': return T_AMMO_SHOTGUN;
161+
case '3': return T_AMMO_UZI;
162+
case '4': return T_AMMO_RIFLE;
163+
case '5': return T_AMMO_GRENADE;
164+
case 'I': return T_INVISIBILITY;
165+
case 'T': return T_TELEPORT;
166+
case 'X': return T_BIOSKULL;
167+
case 'x': return T_BIOMED;
168+
case 'r': return T_BLOODRAIN;
169+
170+
/* birthplace */
171+
case 'B': return TYPE_BIRTHPLACE;
172+
173+
default: return -1;
174+
}
198175
}
199176

200177

data.h

+6-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#define TYPE_BIRTHPLACE 666
1818

1919
/* object types */
20-
#define N_TYPES 28
20+
#define N_TYPES 29
2121

2222
#define T_PLAYER 0
2323
#define T_BULLET 1
@@ -47,10 +47,12 @@
4747
#define T_CHAIN 25
4848
#define T_BIOSKULL 26
4949
#define T_BIOMED 27
50+
#define T_BLOODRAIN 28
5051

5152
#define E_INCOMPATIBLE_VERSION 0
5253
#define E_PLAYER_REFUSED 1
5354

55+
#define WEAPON_BLOODRAIN 7
5456
#define WEAPON_CHAINSAW 6
5557
#define WEAPON_BFG 5
5658
#define WEAPON_GRENADE 4
@@ -59,6 +61,7 @@
5961
#define WEAPON_SHOTGUN 1
6062
#define WEAPON_GUN 0
6163

64+
#define WEAPON_MASK_BLOODRAIN 128
6265
#define WEAPON_MASK_CHAINSAW 64
6366
#define WEAPON_MASK_BFG 32
6467
#define WEAPON_MASK_GRENADE 16
@@ -82,6 +85,7 @@
8285
#define S_NOISE 0x1000
8386
#define S_CHAINSAW 0x2000
8487
#define S_ILL 0x4000
88+
#define S_BLOODRAIN 0x8000
8589

8690
#define M_DEFAULT 0x00
8791
#define M_CHAT 0x01
@@ -115,7 +119,7 @@
115119
#define E_CONN 0x02
116120
#define E_CONN_SUCC 0x04
117121

118-
#define ARMS 7
122+
#define ARMS 8
119123

120124
unsigned char *weapon_name[ARMS];
121125

data/level1.dn

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ toadstool I 541 368
6565
water F 935 472
6666
water F 955 472
6767
water F 975 472
68-
blood F 79 192
68+
blood r 79 192
6969
swing_lamp N 539 0
7070
swing_lamp F 478 0
7171
smoker F 317 428

data/sprites.dat

+10
Original file line numberDiff line numberDiff line change
@@ -95,3 +95,13 @@ bfgbit9 grx/bfgbit9.avi
9595
bfgbit10 grx/bfgbit10.avi
9696
sawchain grx/chain.avi
9797
biomed grx/biomed.avi
98+
bloodrain1 grx/bloodrain1.avi
99+
bloodrain2 grx/bloodrain2.avi
100+
bloodrain3 grx/bloodrain3.avi
101+
bloodrain4 grx/bloodrain4.avi
102+
bloodrain5 grx/bloodrain5.avi
103+
bloodrain6 grx/bloodrain6.avi
104+
bloodrain7 grx/bloodrain7.avi
105+
bloodrain8 grx/bloodrain8.avi
106+
bloodrain9 grx/bloodrain9.avi
107+
bloodrain10 grx/bloodrain10.avi

grx/bloodrain1.avi

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
p0,0
2+
l(
3+
a9
4+
s0

grx/bloodrain10.avi

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
p0,0
2+
l#
3+
a9
4+
s0

grx/bloodrain2.avi

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
p0,0
2+
l^
3+
a9
4+
s0

grx/bloodrain3.avi

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
p0,0
2+
l)
3+
a9
4+
s0

grx/bloodrain4.avi

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
p0,0
2+
l/
3+
a9
4+
s0

grx/bloodrain5.avi

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
p0,0
2+
l\
3+
a9
4+
s0

grx/bloodrain6.avi

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
p0,0
2+
l|
3+
a9
4+
s0

grx/bloodrain7.avi

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
p0,0
2+
l-
3+
a9
4+
s0

grx/bloodrain8.avi

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
p0,0
2+
l=
3+
a9
4+
s0

grx/bloodrain9.avi

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
p0,0
2+
l+
3+
a9
4+
s0

net.h

+1
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
#define P_CHANGE_LEVEL 31
4242
#define P_LEVEL_ACCEPTED 32
4343
#define P_EXPLODE_BFG 33
44+
#define P_EXPLODE_BLOODRAIN 34
4445

4546

4647
/* socket filedescriptor */

0 commit comments

Comments
 (0)