 Part of a series, please check out the annotation on screen for the full playlist, obviously watch the previous videos, make sure you have everything set up for that you need for editing the code and that you downloaded the code. Working with PRBOOM, which is a version of DOOM, and we're just having fun with the source code. I think this last week that we're going to be looking at the source code, really well we'll be looking at the source code, but next week and the week after we're probably going to be looking at modifying the binaries that we compile with a hex editor, but for today we're going to be swapping out some items and in the end creating a endless blood bath of enemies. So let's go ahead and if we jump into a file here, I'm going to use Vim as my text editor and I'm going to go into the file called source, in the folder source info C and we were in here in probably the first or second tutorial and I showed you that each item in the game is defined here and its initial settings are set up. So you know, spawn health, we remove this make shootable from it and the bad guys ignored us. I can set the players, well here it says speed is zero because it doesn't move until you move them. You can set the mass, the height, the radius, now damage it causes, sounds that it makes or those are sounds or types of deaths, animations, these are animation frames that we looked at in the shotgun tutorial, but important thing is each item has its own doom number. Now if it's negative one, I think I accidentally said in a different story that negative one is the player, actually negative one is I think any item that's not there initially. So you shoot a rocket, you shoot a plasma beam or a BFG shot, I think all those things will be set to negative one, but for the most part items and monsters and weapons all have their own unique doomed number. So possessed here is our zombie, its number is three thousand and four. The shotgun guy is nine. So what I could do theoretically is change this to nine and you would think oh wherever a zombie goes a shotgun guy will now go. Depending on what order things are in this list that might work, but it will mess something else up. Everything has to have its own unique numbers. So the shotgun, the zombie is three thousand four. So what we're going to do is we're just going to switch these two. It's the best way to do this. So now anywhere there was a zombie guy, there's now a shotgun guy, anywhere there was a shotgun guy, there's now a zombie guy. So let's go ahead and save this and we will make it and we will run doom. Oops, if I could type today. So before those are just pistol zombie guys now they are shotgun guys and anywhere there was a pistol guy there's now a shotgun guy and the other way around as well, which at this difficulty level there are there were no shotgun guys on this level. Hard difficulty, I think there were some outside, but you get the point. So if you were to just change one of these, again, depending on the order one will work and the other one will just not be there. So like if I was to change the shotgun guy back here to nine, make the game and go in, let's see. There's nothing there because it's going to recognize the second one. So the shotgun guys where they are, I believe are still going to be there, but these guys are gone because the second one overrode the first. That being said, now when you are creating your own level or editing a level in doom and using level editor, if you have a good level editor, it lets you import or at least you specify which binary you're using. So this binary is probably look at that and it will grab all the ID numbers out of there. If you're using an older editor and may not have that feature may only be able to use monsters and items that are already there. So if you wanted to create your own, you can do that, but you need a level editor that allows you to do that. But let's have a little more fun with this and I'll show you. We'll go in here back into the source code. I'll change this back to was it three thousand four. So actually according to my notes, the chainsaw is two thousand five. Now if I go and find two thousand five somewhere else, I can change that to three thousand four. So I just swapped the chainsaw for the zombie guy. So now if I make that and I start the game, you can see everywhere there was a zombie, there's now a chainsaw, which I can go pick up. But initially in the original game, well secret, if you turn around at the very beginning, there's a chainsaw over here. There's not now. There's a zombie guy. So I can pick up the chainsaw, but all these bad guys are now chainsaws. Same with these in here. So let's swapping items. Now, I said earlier, this is going to lead to a blood bath. There's another way to set where items are. So let's go ahead and go back into our code. We're going to change this back to three thousand four. And we're going to look for two thousand five. Oh, that's right. It's not two thousand five. I want to change it back to two thousand five. Change, type in the right number. I keep typing the wrong number. Okay. Okay. So zombie, the possessed, we want to change this back to two thousand five. So chainsaws back to being the two thousand five. If we make that, just make sure I did that properly. Things should be back. Okay, they're there and there's a chainsaw over there. Okay. Well, before I exit, let me show you, when you shoot the bad guys, they drop a little ammo clip, these little pistol guys. And there's already an ammo clip over in the corner here. So you think, okay, if I swap out the ammo clip and the shotgun guy, I should get a shotgun guy when I kill a pistol guy. That's logical thinking, but that's that's not how it works. Because the we're changing the doom number here, the doom number, which is set for placing items on a map, not when they're spawned elsewhere necessarily, sometimes possibly. So what I want to do here is that, as I said, the shotgun guy is nine, ammo clip is 2007. So if I find 2007, I'll change this to nine. And then I will find nine comma, let's go back to the beginning of the file and search nine comma, keep searching for that a little bit down a lot. Okay, here it is right here shotgun guy. And we'll change him I said the clip was 2007. We'll make that. We'll run that we'll go in here and look, we got those guys where that clip was over there. It's a shotgun guy. So that worked. I swapped out those two. But if I shoot these guys, they're still dropping ammo clips, not shotgun guys. That's because we need to find the function where bad guys drop stuff. So real quick, let's find that. And for my notes, I know that if I use my text editor and I jumped a line 787 of source P underscore into C enter C. Here we see drop stuff. This determines the kind of objects spawned during a death frame of a thing, a thing in this case will be our enemies. And we have a case statement here. We're saying, okay, if it's possessed, so if it's a zombie, drop a clip. If it's a shotgun guy, drop a shotgun. If it's a chain gun guy, drop a chain gun. So what we can do here is we'll change this instead of dropping a clip. We have to know what an object is called. Well, we already know a shotgun guy right here. It's called shotgun guy. So we'll say, and this is case sensitive, shotgun guy. And we know that a chain gun guy is called chain guy. Be sure to spell things properly. And here, that's not what I want to change. We can change chain gun to possessed for the zombie. If we save that, make that and run that. Now, when I kill these guys, they drop a shotgun guy. When I kill a shotgun guy, they drop a chain gun guy. When I drop chain gun guy, he turns into a pistol guy. So you will end up with an endless bloodbath because you can never kill all the bad guys. IDDQD, IDKFA. Let me have a little fun here too. So you end up with an endless bloodbath and you're going to end up with a whole bunch of dead bodies everywhere. Now you do have some bad guys. I don't know why I'm bothering killing these guys because they're not dying, such as the imps that don't drop anything when they die. I have not done this, but I would assume that you could go into our code here and add a case. You've got to find out the imp's name. I don't know if it's MT, imp, or whatever they're called, but find that out. And you can add a case statement and say that they're item and you can tell them to drop something. You can tell them to drop a BFG. So when you kill an imp, every time you drop them, he's going to give you a BFG. So you can add your own case statements there. I'm not going to do that in this tutorial because I think I've shown you everything I wanted to show you today. But thank you for watching. Please visit FilmsByChris.com. That's Chris Decay. There should be a link in the description as well as a link to hopefully some notes on what we just did here today. I hope you're enjoying this. And again, next week, we're going to start working with a hex editor to modify the binary files of Doom. So as always, I thank you for watching and hope that you have a great day. Okay, this is an introduction to FilmsByChris.com. I'm Chris. That's Chris Decay. That's me right there. My daughter, Ember. And my wife, Jennifer. We pretty much live in the swamps of Florida. I'm a firefighter by day as well as by night. We work long hours. But that's not why you're here. You're here about the videos I put up on YouTube. These videos are mainly about computers and programming, which means most of my videos look something like this. And if that's what you're interested in, great. If not, that's all right. I do videos on other topics too, such as video editing, special effects, photo editing, 3D design, and music creation. If you are one of my viewers and you enjoy my videos, my Patreon page is a place where you can go to help support my videos. So I ask that you take the time to go to my Patreon page and look at different levels of rewards you can receive for different levels of backing. There should be a link in the description of this video if you were watching it on YouTube. Otherwise, you can visit patreon.com forward slash metalx1000. And I thank you for your time and your support. Have a great day.