@@ -3,37 +3,37 @@ const HDCONST_HDBLEVENT = HDCONST_BPSPAWNPOOLEVENT + 1;
33class HDBulletLibHandler : EventHandler {
44 // [Ace] Order here must match order in menu. And zscript files. - [Ted]
55 static const class<HDAmmo> RemovedClasses[] = {
6- " HD50AEAmmo" ,
7- " HDSlugAmmo" ,
8- " HD500SWLightAmmo" ,
9- " HD500SWHeavyAmmo" ,
10- " HD50OMGAmmo" ,
11- " HD45ACPAmmo" ,
12- " HD10mAmmo" ,
13- " HD45LCAmmo" ,
14- " HDLLShellAmmo" ,
15- " HDExplosiveShellAmmo" ,
16- " HDGold45LCAmmo" ,
17- " HDFlareAmmo" ,
18- " HDBallAmmo" ,
19- " HD4GSAmmo" ,
20- " HD5mm_Ammo" ,
21- " HD6mmFlechetteAmmo" ,
22- " HD50AM_Ammo" ,
23- " HDAurochsAmmo" ,
24- " HD069BoreAmmo" ,
25- " TenMilBrass" ,
26- " Wan_ThuRKTAmmo" ,
27- " Wan_TortRKTAmmo" ,
28- " WAN_20mmGrenadeAmmo" ,
29- " ThirtyAughtSixAmmo" ,
30- " ThirtyAughtSixBrass" ,
31- " HD4GBAmmo" ,
32- " HDBirdshotShellAmmo" ,
33- " Savage300Ammo" ,
34- " HD762TokarevAmmo" ,
35- " TokarevBrass" ,
36- " Savage300Brass"
6+ ' HD50AEAmmo' ,
7+ ' HDSlugAmmo' ,
8+ ' HD500SWLightAmmo' ,
9+ ' HD500SWHeavyAmmo' ,
10+ ' HD50OMGAmmo' ,
11+ ' HD45ACPAmmo' ,
12+ ' HD10mAmmo' ,
13+ ' HD45LCAmmo' ,
14+ ' HDLLShellAmmo' ,
15+ ' HDExplosiveShellAmmo' ,
16+ ' HDGold45LCAmmo' ,
17+ ' HDFlareAmmo' ,
18+ ' HDBallAmmo' ,
19+ ' HD4GSAmmo' ,
20+ ' HD5mm_Ammo' ,
21+ ' HD6mmFlechetteAmmo' ,
22+ ' HD50AM_Ammo' ,
23+ ' HDAurochsAmmo' ,
24+ ' HD069BoreAmmo' ,
25+ ' TenMilBrass' ,
26+ ' Wan_ThuRKTAmmo' ,
27+ ' Wan_TortRKTAmmo' ,
28+ ' WAN_20mmGrenadeAmmo' ,
29+ ' ThirtyAughtSixAmmo' ,
30+ ' ThirtyAughtSixBrass' ,
31+ ' HD4GBAmmo' ,
32+ ' HDBirdshotShellAmmo' ,
33+ ' Savage300Ammo' ,
34+ ' HD762TokarevAmmo' ,
35+ ' TokarevBrass' ,
36+ ' Savage300Brass'
3737 };
3838
3939 // [Ace] Future-proofing. I doubt this library will ever have 32 * 3 ammo types and projectiles.
@@ -82,7 +82,7 @@ class HDBulletLibHandler : EventHandler {
8282 }
8383
8484 private bool IsRemovedClass(class<HDAmmo> cls) {
85- foreach (removedClass : RemovedClasses) if (cls == removedClass) return true;
85+ foreach (removedClass : RemovedClasses) if (cls ~ == removedClass) return true;
8686
8787 return false;
8888 }
@@ -104,13 +104,10 @@ class HDBLRSpawnAmmo play {
104104 string toString() {
105105
106106 let replacements = "[";
107- if (spawnReplaces.size()) {
108- replacements = replacements..spawnReplaces[0].toString();
109107
110- foreach (replacee : spawnReplaces) replacements = replacements..", "..replacee.toString();
111- }
112- replacements = replacements.."]";
108+ foreach (replacee : spawnReplaces) replacements = replacements..", "..replacee.toString();
113109
110+ replacements = replacements.."]";
114111
115112 return String.format("{ spawnName=%s, spawnReplaces=%s, isPersistent=%b, replaceAmmo=%b }", spawnName, replacements, isPersistent, replaceAmmo);
116113 }
@@ -129,20 +126,20 @@ class HDBulletLibAmmoSpawner: EventHandler {
129126 // List of persistent classes to completely ignore.
130127 // This -should- mean this mod has no performance impact.
131128 static const string blacklist[] = {
132- " HDSmoke" ,
133- " BloodTrail" ,
134- " CheckPuff" ,
135- " WallChunk" ,
136- " HDBulletPuff" ,
137- " HDFireballTail" ,
138- " ReverseImpBallTail" ,
139- " HDSmokeChunk" ,
140- " ShieldSpark" ,
141- " HDFlameRed" ,
142- " HDMasterBlood" ,
143- " PlantBit" ,
144- " HDBulletActor" ,
145- " HDLadderSection"
129+ ' HDSmoke' ,
130+ ' BloodTrail' ,
131+ ' CheckPuff' ,
132+ ' WallChunk' ,
133+ ' HDBulletPuff' ,
134+ ' HDFireballTail' ,
135+ ' ReverseImpBallTail' ,
136+ ' HDSmokeChunk' ,
137+ ' ShieldSpark' ,
138+ ' HDFlameRed' ,
139+ ' HDMasterBlood' ,
140+ ' PlantBit' ,
141+ ' HDBulletActor' ,
142+ ' HDLadderSection'
146143 };
147144
148145 // List of ammo spawn associations.
@@ -155,9 +152,9 @@ class HDBulletLibAmmoSpawner: EventHandler {
155152 void addAmmo(string name, Array<HDBLRSpawnAmmoEntry> replacees, bool persists, bool rep=true) {
156153
157154 if (hd_debug) {
158- let msg = "Adding "..(persists ? "Persistent" : "Non-Persistent").." Replacement Entry for "..name..": ["..replacees[0].toString() ;
155+ let msg = "Adding "..(persists ? "Persistent" : "Non-Persistent").." Replacement Entry for "..name..": [";
159156
160- if (replacees.size() > 1) foreach (replacee : replacees) msg = msg..", "..replacee.toString();
157+ foreach (replacee : replacees) msg = msg..", "..replacee.toString();
161158
162159 console.printf(msg.."]");
163160 }
@@ -169,8 +166,7 @@ class HDBulletLibAmmoSpawner: EventHandler {
169166 spawnee.spawnName = name;
170167 spawnee.isPersistent = persists;
171168 spawnee.replaceAmmo = rep;
172-
173- foreach (replacee : replacees) spawnee.spawnReplaces.push(replacee);
169+ spawnee.spawnreplaces.copy(replacees);
174170
175171 // Pushes the finished struct to the array.
176172 ammoSpawnList.push(spawnee);
@@ -179,7 +175,7 @@ class HDBulletLibAmmoSpawner: EventHandler {
179175 HDBLRSpawnAmmoEntry addAmmoEntry(string name, int chance) {
180176 // Creates a new struct;
181177 HDBLRSpawnAmmoEntry spawnee = HDBLRSpawnAmmoEntry(new('HDBLRSpawnAmmoEntry'));
182- spawnee.name = name.makelower() ;
178+ spawnee.name = name;
183179 spawnee.chance = chance;
184180 return spawnee;
185181 }
@@ -498,7 +494,7 @@ class HDBulletLibAmmoSpawner: EventHandler {
498494 if (chance > -1) {
499495 let result = random(0, chance);
500496
501- if (hd_debug) console.printf("Rolled a "..result.." out of "..(chance + 1));
497+ if (hd_debug) console.printf("Rolled a "..( result + 1) .." out of "..(chance + 1));
502498
503499 return result == 0;
504500 }
@@ -532,10 +528,9 @@ class HDBulletLibAmmoSpawner: EventHandler {
532528 foreach (bl : blacklist) if (e.Thing is bl) return;
533529
534530 string candidateName = e.Thing.GetClassName();
535- candidateName = candidateName.makelower();
536531
537532 // Return if range before replacing things.
538- if (level.MapName ~ == " RANGE" ) return;
533+ if (level.MapName == ' RANGE' ) return;
539534
540535 handleAmmoReplacements(e.Thing, candidateName);
541536 }
@@ -553,7 +548,7 @@ class HDBulletLibAmmoSpawner: EventHandler {
553548 let item = Inventory(thing);
554549 if ((prespawn || ammoSpawn.isPersistent) && (!(item && item.owner) && prespawn)) {
555550 foreach (spawnReplace : ammoSpawn.spawnReplaces) {
556- if (spawnReplace.name == candidateName) {
551+ if (spawnReplace.name ~ == candidateName) {
557552 if (hd_debug) console.printf("Attempting to replace "..candidateName.." with "..ammoSpawn.spawnName.."...");
558553
559554 if (tryCreateAmmo(thing, ammoSpawn.spawnName, spawnReplace.chance, ammoSpawn.replaceAmmo)) return;
0 commit comments