Skip to content

Commit

Permalink
Classic DOOM - MBF21 - Add thing meleerange and weapon MBF21 Bits
Browse files Browse the repository at this point in the history
  • Loading branch information
MadDeCoDeR committed Jan 12, 2025
1 parent 7abd069 commit 4048139
Show file tree
Hide file tree
Showing 8 changed files with 328 additions and 168 deletions.
22 changes: 15 additions & 7 deletions doomclassic/doom/d_deh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,13 @@ dehbits mobfl[] = {
{"E4M6BOSS", MF2_E4M6BOSS},
{"E4M8BOSS", MF2_E4M8BOSS},
{"RIP", MF2_RIP},
{"FULLVOLSOUNDS", MF2_FULLVOLSOUNDS}
{"FULLVOLSOUNDS", MF2_FULLVOLSOUNDS},
{"NOTHRUST", WPF_NOTHRUST},
{"SILENT", WPF_SILENT},
{"NOAUTOFIRE", WPF_NOAUTOFIRE},
{"FLEEMELEE", WPF_FLEEMELEE},
{"AUTOSWITCHFROM", WPF_AUTOSWITCHFROM},
{"NOAUTOSWITCHTO", WPF_NOAUTOSWITCHTO}
};

int checkstate(char* text) {
Expand Down Expand Up @@ -431,7 +437,7 @@ int checkstate(char* text) {

void setThing(int pos, char* varname, int varval) {
//GK: This works (suprisingly)
dehobj tvars[28] = {
dehobj tvars[29] = {
{"Initial frame ",MAXINT,NULL,&mobjinfo[pos].spawnstate},
{"Hit points ",MAXINT,NULL,&mobjinfo[pos].spawnhealth},
{"First moving frame ",MAXINT,NULL,&mobjinfo[pos].seestate},
Expand Down Expand Up @@ -460,8 +466,9 @@ void setThing(int pos, char* varname, int varval) {
{"Splash group", MAXINT, NULL, &mobjinfo[pos].splashGroup},
{"MBF21 Bits ",MAXINT,NULL, NULL, NULL, NULL, NULL, NULL, NULL, &mobjinfo[pos].flags2},
{"Fast speed ",MAXINT,NULL, &mobjinfo[pos].altSpeed},
{"Melee range ", MAXINT, NULL, &mobjinfo[pos].meleeRange}
};
for (int i = 0; i < 28; i++) {
for (int i = 0; i < 29; i++) {
if (!idStr::Icmp(varname, tvars[i].name)) {
if (varval < tvars[i].limit) {
if (tvars[i].llval != NULL) {
Expand Down Expand Up @@ -538,15 +545,16 @@ void setFrame(int pos, char* varname, int varval) {
}

void setWeapon(int pos, char* varname, int varval) {
dehobj wvars[6] = {
dehobj wvars[7] = {
{"Select frame ",MAXINT,NULL,&weaponinfo[pos].downstate},
{"Deselect frame ",MAXINT,NULL,&weaponinfo[pos].upstate},
{"Bobbing frame ",MAXINT,NULL,&weaponinfo[pos].readystate},
{"Shooting frame ",MAXINT,NULL,&weaponinfo[pos].atkstate},
{"Firing frame ",MAXINT,NULL,&weaponinfo[pos].flashstate},
{"Ammo type ",NUMAMMO,NULL,NULL,NULL,NULL,NULL,NULL,&weaponinfo[pos].ammo}
{"Ammo type ",NUMAMMO,NULL,NULL,NULL,NULL,NULL,NULL,&weaponinfo[pos].ammo},
{"MBF21 Bits ", MAXINT, NULL, &weaponinfo[pos].flags}
};
for (int i = 0; i < 6; i++) {
for (int i = 0; i < 7; i++) {
if (!idStr::Icmp(varname, wvars[i].name)) {
if (varval < wvars[i].limit) {
switch (i) {
Expand Down Expand Up @@ -911,7 +919,7 @@ void parsetext(char* text) {
if (!tv3.empty()) {
if (state != 6 && state != 9) {
varval = atoi(tv3.c_str());
if (state == 1 && (!idStr::Icmp(varname, "Bits ") || !idStr::Icmp(varname, "MBF21 Bits ")) && varval == 0) {
if ((state == 1 || state == 4)&& (!idStr::Icmp(varname, "Bits ") || !idStr::Icmp(varname, "MBF21 Bits ")) && varval == 0) {
varval = Generateflags(strdup(tv3.c_str()));
}
}
Expand Down
15 changes: 10 additions & 5 deletions doomclassic/doom/d_items.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ void initWeapons() {
S_PUNCHDOWN,
S_PUNCH,
S_PUNCH1,
S_NULL
S_NULL,
WPF_FLEEMELEE | WPF_AUTOSWITCHFROM | WPF_NOAUTOSWITCHTO
},
{
// pistol
Expand All @@ -71,7 +72,8 @@ void initWeapons() {
S_PISTOLDOWN,
S_PISTOL,
S_PISTOL1,
S_PISTOLFLASH
S_PISTOLFLASH,
WPF_AUTOSWITCHFROM
},
{
// shotgun
Expand All @@ -98,7 +100,8 @@ void initWeapons() {
S_MISSILEDOWN,
S_MISSILE,
S_MISSILE1,
S_MISSILEFLASH1
S_MISSILEFLASH1,
WPF_NOAUTOFIRE
},
{
// plasma rifle
Expand All @@ -116,7 +119,8 @@ void initWeapons() {
S_BFGDOWN,
S_BFG,
S_BFG1,
S_BFGFLASH1
S_BFGFLASH1,
WPF_NOAUTOFIRE
},
{
// chainsaw
Expand All @@ -125,7 +129,8 @@ void initWeapons() {
S_SAWDOWN,
S_SAW,
S_SAW1,
S_NULL
S_NULL,
WPF_FLEEMELEE | WPF_NOTHRUST | WPF_NOAUTOSWITCHTO
},
{
// super shotgun
Expand Down
13 changes: 12 additions & 1 deletion doomclassic/doom/d_items.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,19 @@ typedef struct
int readystate;
int atkstate;
int flashstate;

int flags;
} weaponinfo_t;

typedef enum
{
WPF_NOTHRUST = 0x001,
WPF_SILENT = 0x002,
WPF_NOAUTOFIRE = 0x004,
WPF_FLEEMELEE = 0x008,
WPF_AUTOSWITCHFROM = 0x010,
WPF_NOAUTOSWITCHTO = 0x020
} weaponflags_t;

//GK: No more constant variable
extern /*const*/ weaponinfo_t weaponinfo[NUMWEAPONS];
void initWeapons();
Expand Down
Loading

0 comments on commit 4048139

Please sign in to comment.