Skip to content

Commit a80c144

Browse files
authored
Merge pull request #17 from lordee/master
bring shock/plasma up to date with master
2 parents e3c0f4c + 25720f8 commit a80c144

File tree

9 files changed

+120
-22
lines changed

9 files changed

+120
-22
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@
55
*.patch
66
fteqcc64
77
.vscode/tasks.json
8+
.gitignore

actions.qc

+59-17
Original file line numberDiff line numberDiff line change
@@ -6,45 +6,43 @@ void () TeamFortress_ClipTick;
66

77
void () TeamFortress_Discard = {
88
newmis = spawn();
9-
switch (self.playerclass)
10-
{
9+
10+
switch (self.playerclass) {
1111
case PC_SCOUT:
1212
case PC_ENGINEER:
13+
newmis.ammo_rockets = self.ammo_rockets;
14+
break;
1315
case PC_MEDIC:
1416
newmis.ammo_rockets = self.ammo_rockets;
15-
break;
17+
if (!medicaura && old_medikit) {
18+
newmis.ammo_cells = self.ammo_cells;
19+
}
20+
break;
1621
case PC_SNIPER:
1722
case PC_SPY:
1823
newmis.ammo_rockets = self.ammo_rockets;
1924
newmis.ammo_cells = self.ammo_cells;
20-
break;
25+
break;
2126
case PC_SOLDIER:
2227
case PC_DEMOMAN:
2328
newmis.ammo_cells = self.ammo_cells;
2429
newmis.ammo_nails = self.ammo_nails;
25-
break;
30+
break;
2631
case PC_HVYWEAP:
2732
newmis.ammo_rockets = self.ammo_rockets;
2833
newmis.ammo_nails = self.ammo_nails;
29-
break;
34+
break;
3035
case PC_PYRO:
3136
case PC_PLASMA:
3237
if (plasmaclass) {
3338
newmis.ammo_rockets = self.ammo_rockets;
3439
}
3540
newmis.ammo_nails = self.ammo_nails;
41+
break;
42+
default:
3643
}
37-
38-
if (self.playerclass == PC_MEDIC && !medicaura && old_medikit)
39-
newmis.ammo_cells = self.ammo_cells;
40-
41-
if (!(newmis.ammo_shells + newmis.ammo_nails + newmis.ammo_rockets + newmis.ammo_cells)) {
42-
dremove(newmis);
43-
if (self.menu_input != Menu_Drop_Input)
44-
Menu_Drop();
45-
else
46-
Menu_Close(self);
47-
return;
44+
if ((newmis.ammo_rockets + newmis.ammo_cells + newmis.ammo_nails + newmis.ammo_shells) == 0) {
45+
return;
4846
}
4947

5048
if (newmis.ammo_shells) {
@@ -85,6 +83,50 @@ void () TeamFortress_Discard = {
8583
setmodel(newmis, "progs/backpack.mdl");
8684
};
8785

86+
void () TeamFortress_Discard_DropAmmo = {
87+
// if nothing to discard, do dropammo instead
88+
float disc;
89+
disc = 0;
90+
91+
switch (self.playerclass) {
92+
case PC_SCOUT:
93+
case PC_ENGINEER:
94+
disc = self.ammo_rockets;
95+
break;
96+
case PC_MEDIC:
97+
disc = self.ammo_rockets;
98+
if (!medicaura && old_medikit) {
99+
disc += self.ammo_cells;
100+
}
101+
break;
102+
case PC_SNIPER:
103+
case PC_SPY:
104+
disc = self.ammo_rockets + self.ammo_cells;
105+
break;
106+
case PC_SOLDIER:
107+
case PC_DEMOMAN:
108+
disc = self.ammo_cells + self.ammo_nails;
109+
break;
110+
case PC_HVYWEAP:
111+
disc = self.ammo_rockets + self.ammo_nails;
112+
break;
113+
case PC_PYRO:
114+
disc = self.ammo_nails;
115+
break;
116+
default:
117+
}
118+
119+
if (disc == 0) {
120+
if (self.menu_input != Menu_Drop_Input)
121+
Menu_Drop();
122+
else
123+
Menu_Close(self);
124+
return;
125+
} else {
126+
TeamFortress_Discard();
127+
}
128+
};
129+
88130
void () TeamFortress_SaveMe = {
89131
local entity te, tl;
90132

buttons.qc

+16
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,14 @@ void () button_done = {
1818
};
1919

2020
void () button_return = {
21+
// q3f support
22+
string targname;
23+
entity targ;
24+
targ = world;
25+
targname = self.target;
26+
targ = find(targ, targetname, targname);
27+
targ.active = TFGS_INACTIVE;
28+
2129
self.goal_state = TFGS_INACTIVE;
2230
self.state = STATE_DOWN;
2331
SUB_CalcMove(self.pos1, self.speed, button_done);
@@ -34,6 +42,14 @@ void () button_fire = {
3442
if ((self.state == STATE_UP) || (self.state == STATE_TOP))
3543
return;
3644

45+
// q3f support
46+
string targname;
47+
entity targ;
48+
targ = world;
49+
targname = self.target;
50+
targ = find(targ, targetname, targname);
51+
targ.active = TFGS_ACTIVE;
52+
3753
sound(self, CHAN_VOICE, self.noise, 1, ATTN_NORM);
3854

3955
self.state = STATE_UP;

defs.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -403,8 +403,8 @@
403403
#define TF_ENGINEER_BUILD 77 // Engineer: Bring up build menu for Engineer
404404
#define TF_ENGINEER_DETDISP 78 // Engineer: Detonate dispenser for Engineer
405405
#define TF_ENGINEER_DETSENTRY 79 // Engineer: Detonate sentry gun for Engineer
406-
#define TF_DISGUISE_PLASMA 80 // Spy: Disguise as Plasma
407-
// unused 81
406+
#define TF_DISCARD_DROP_AMMO 80
407+
#define TF_DISGUISE_PLASMA 81 // Spy: Disguise as Plasma
408408
// unused 82
409409
// unused 83
410410
// unused 84

q3defs.qc

+2-1
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,5 @@
1313
.string carried_all_sound;
1414
.string inactive_all_message;
1515
.string activetarget;
16-
.string checkstate;
16+
.string checkstate;
17+
.float active;

qw.qc

+3
Original file line numberDiff line numberDiff line change
@@ -510,8 +510,11 @@ float intermission_exittime;
510510
// add clientkill ent defs
511511
.float clientkillforce;
512512
.float clientkillfree;
513+
514+
// plasma class
513515
.float lifenum;
514516

517+
515518
//============================================================================
516519

517520
void (float psize, entity p) KickPlayer = {

tforthlp.qc

+1
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ void () TeamFortress_MOTD = {
109109
TeamFortress_Alias("special", TF_SPECIAL_SKILL, 0);
110110
TeamFortress_Alias("saveme", TF_MEDIC_HELPME, 0);
111111
TeamFortress_Alias("discard", TF_DISCARD, 0);
112+
TeamFortress_Alias("discard_drop_ammo", TF_DISCARD_DROP_AMMO, 0);
112113
} else if (self.motd == 60) {
113114
TeamFortress_Alias("weapnext", TF_WEAPNEXT, 0);
114115
TeamFortress_Alias("weapprev", TF_WEAPPREV, 0);

tfortmap.qc

+30
Original file line numberDiff line numberDiff line change
@@ -1333,6 +1333,33 @@ void (entity Goal, entity AP, entity ActivatingGoal) AttemptToActivate = {
13331333
if (cb_prematch_time > time)
13341334
return;
13351335

1336+
1337+
// q3f support
1338+
if (Goal.checkstate != string_null) {
1339+
string cname, cstate;
1340+
float slen, idx;
1341+
entity targ;
1342+
targ = world;
1343+
1344+
idx = strstrofs(Goal.checkstate, "=");
1345+
slen = strlen(Goal.checkstate);
1346+
cname = substring(Goal.checkstate, 0, idx);
1347+
targ = find(targ, targetname, cname);
1348+
cstate = substring(Goal.checkstate, idx + 1, slen);
1349+
switch (cstate)
1350+
{
1351+
case "inactive":
1352+
if (targ.active == TFGS_ACTIVE) {
1353+
return;
1354+
}
1355+
break;
1356+
case "active":
1357+
if (targ.active == TFGS_INACTIVE) {
1358+
return;
1359+
}
1360+
}
1361+
}
1362+
13361363
if (Activated(Goal, AP)) {
13371364
if (ActivatingGoal == Goal)
13381365
DoResults(Goal, AP, 1);
@@ -1638,6 +1665,7 @@ void (entity Goal, entity AP, float addb) DoResults = {
16381665
te.weapon = addb;
16391666
return;
16401667
}
1668+
16411669
UpdateAbbreviations(Goal);
16421670
Goal.goal_state = 2;
16431671
if ((Goal.classname == "info_tfgoal") && (Goal.mdl != string_null)) {
@@ -1946,6 +1974,7 @@ void () tfgoal_touch = {
19461974
};
19471975

19481976
void () info_tfgoal_use = {
1977+
dprint("info_tfgoal_use\n");
19491978
AttemptToActivate(self, activator, self);
19501979
};
19511980

@@ -2835,5 +2864,6 @@ void (entity player) DropGoalItems = {
28352864
te = find(te, classname, "item_tfgoal");
28362865
}
28372866
dremove(newmis);
2867+
28382868
TeamFortress_SetSpeed(player);
28392869
};

weapons.qc

+6-2
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ void () TeamFortress_EngineerBuild;
6060
void () TeamFortress_EngineerBuildStop;
6161
void () TeamFortress_Scan;
6262
void () TeamFortress_Discard;
63+
void () TeamFortress_Discard_DropAmmo;
6364
void (float force) TeamFortress_DetonatePipebombs;
6465
void (float timer) TeamFortress_SetDetpack;
6566
void () TeamFortress_DetpackStop;
@@ -2403,6 +2404,8 @@ void () ImpulseCommands = {
24032404
DropGoalItems(self);
24042405
else if (self.impulse == TF_DISCARD)
24052406
TeamFortress_Discard();
2407+
else if (self.impulse == TF_DISCARD_DROP_AMMO)
2408+
TeamFortress_Discard_DropAmmo();
24062409
else if (self.impulse == TF_DASH)
24072410
CF_Scout_Dash();
24082411
else if (self.impulse == TF_PB_DETONATE)
@@ -2763,8 +2766,9 @@ void () W_WeaponFrame = {
27632766
}
27642767
}
27652768

2766-
// class specials and grenade impulses always possible
2767-
if (self.impulse == TF_SPECIAL_SKILL ||(self.impulse >= TF_GRENADE_1 && self.impulse <= TF_GRENADE_SWITCH)) {
2769+
// class specials and grenade impulses always possible, also detpipe
2770+
if (self.impulse == TF_SPECIAL_SKILL ||(self.impulse >= TF_GRENADE_1 && self.impulse <= TF_GRENADE_SWITCH)
2771+
|| self.impulse == TF_PB_DETONATE) {
27682772
ImpulseCommands();
27692773
return;
27702774
}

0 commit comments

Comments
 (0)