From b4a206c063d2ac43c7e3aa7732f7db6ede56ac3a Mon Sep 17 00:00:00 2001 From: MascaraSnake Date: Tue, 28 Dec 2021 13:14:48 +0100 Subject: [PATCH] Adapt remaining enemies to UDMF --- extras/conf/udb/Includes/SRB222_things.cfg | 125 ++++++++++++++++++++- src/p_enemy.c | 21 +++- src/p_mobj.c | 53 ++++++++- src/p_setup.c | 37 +++++- src/p_spec.h | 13 +++ 5 files changed, 235 insertions(+), 14 deletions(-) diff --git a/extras/conf/udb/Includes/SRB222_things.cfg b/extras/conf/udb/Includes/SRB222_things.cfg index 58c4fe53d..102805b1b 100644 --- a/extras/conf/udb/Includes/SRB222_things.cfg +++ b/extras/conf/udb/Includes/SRB222_things.cfg @@ -3607,6 +3607,12 @@ udmf sprite = "BUZZA1"; width = 28; height = 40; + arg0 + { + title = "Can move?"; + type = 11; + enum = "yesno"; + } } 104 { @@ -3614,6 +3620,12 @@ udmf sprite = "RBUZA1"; width = 28; height = 40; + arg0 + { + title = "Can move?"; + type = 11; + enum = "yesno"; + } } 108 { @@ -3674,6 +3686,16 @@ udmf sprite = "CRABA0"; width = 24; height = 32; + arg0 + { + title = "Spawn direction"; + type = 11; + enum + { + 0 = "Right"; + 1 = "Left"; + } + } } 138 { @@ -3681,6 +3703,16 @@ udmf sprite = "CR2BA0"; width = 24; height = 32; + arg0 + { + title = "Spawn direction"; + type = 11; + enum + { + 0 = "Right"; + 1 = "Left"; + } + } } 117 { @@ -3688,6 +3720,12 @@ udmf sprite = "ARCHA1"; width = 24; height = 32; + arg0 + { + title = "Can jump?"; + type = 11; + enum = "yesno"; + } } 118 { @@ -3709,6 +3747,23 @@ udmf sprite = "ESHIA1"; width = 16; height = 48; + arg0 + { + title = "Turn direction"; + type = 11; + enum + { + 0 = "Back"; + 1 = "Right"; + 2 = "Left"; + } + } + arg1 + { + title = "Double speed?"; + type = 11; + enum = "noyes"; + } } 115 { @@ -3784,6 +3839,12 @@ udmf sprite = "JETBB1"; width = 20; height = 50; + arg0 + { + title = "Can move?"; + type = 11; + enum = "yesno"; + } } 106 { @@ -3791,6 +3852,12 @@ udmf sprite = "JETGB1"; width = 20; height = 48; + arg0 + { + title = "Can move?"; + type = 11; + enum = "yesno"; + } } 112 { @@ -3840,6 +3907,12 @@ udmf sprite = "CACOA0"; width = 32; height = 32; + arg0 + { + title = "Can move?"; + type = 11; + enum = "yesno"; + } } 133 { @@ -3866,6 +3939,12 @@ udmf sprite = "BUMBA1"; width = 16; height = 32; + arg0 + { + title = "Can move?"; + type = 11; + enum = "yesno"; + } } 124 { @@ -4551,6 +4630,12 @@ udmf sprite = "BUBLE0"; width = 8; height = 16; + arg0 + { + title = "Distance check?"; + type = 11; + enum = "yesno"; + } } 501 { @@ -4686,9 +4771,13 @@ udmf } arg1 { - title = "Invisible?"; - type = 11; - enum = "noyes"; + title = "Flags"; + type = 12; + enum + { + 1 = "Invisible"; + 2 = "No distance check"; + } } } 541 @@ -4710,6 +4799,12 @@ udmf sprite = "BLONA0"; width = 32; height = 64; + arg0 + { + title = "Respawn?"; + type = 11; + enum = "noyes"; + } stringarg0 { title = "Color"; @@ -5942,6 +6037,12 @@ udmf sprite = "BTBLA0"; width = 24; height = 48; + arg0 + { + title = "Move perpetually?"; + type = 11; + enum = "noyes"; + } } 1201 { @@ -5949,6 +6050,12 @@ udmf sprite = "STBLA0"; width = 12; height = 24; + arg0 + { + title = "Move perpetually?"; + type = 11; + enum = "noyes"; + } } 1202 { @@ -6608,6 +6715,12 @@ udmf sprite = "NTPNALAR"; width = 16; height = 32; + arg0 + { + title = "Can move?"; + type = 11; + enum = "yesno"; + } } } @@ -6727,6 +6840,12 @@ udmf 3 = "Top"; } } + arg4 + { + title = "Die upon time up?"; + type = 11; + enum = "noyes"; + } } 1704 { diff --git a/src/p_enemy.c b/src/p_enemy.c index 27f169e20..e077b3926 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -7909,12 +7909,21 @@ void A_GuardChase(mobj_t *actor) false) && speed > 0) // can't be the same check as previous so that P_TryMove gets to happen. { - if (actor->spawnpoint && ((actor->spawnpoint->options & (MTF_EXTRA|MTF_OBJECTSPECIAL)) == MTF_OBJECTSPECIAL)) - actor->angle += ANGLE_90; - else if (actor->spawnpoint && ((actor->spawnpoint->options & (MTF_EXTRA|MTF_OBJECTSPECIAL)) == MTF_EXTRA)) - actor->angle -= ANGLE_90; - else - actor->angle += ANGLE_180; + INT32 direction = actor->spawnpoint ? actor->spawnpoint->args[0] : TMGD_BACK; + + switch (direction) + { + case TMGD_BACK: + default: + actor->angle += ANGLE_180; + break; + case TMGD_RIGHT: + actor->angle -= ANGLE_90; + break; + case TMGD_LEFT: + actor->angle += ANGLE_90; + break; + } } if (actor->extravalue1 < actor->info->speed) diff --git a/src/p_mobj.c b/src/p_mobj.c index 55f7a729a..aa27c4015 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -2681,7 +2681,7 @@ boolean P_ZMovement(mobj_t *mo) { if (mo->flags2 & MF2_AMBUSH) { - // If deafed, give the tumbleweed another random kick if it runs out of steam. + // Give the tumbleweed another random kick if it runs out of steam. mom.z += P_MobjFlip(mo)*FixedMul(6*FRACUNIT, mo->scale); if (P_RandomChance(FRACUNIT/2)) @@ -12504,6 +12504,9 @@ static boolean P_SetupNiGHTSDrone(mapthing_t *mthing, mobj_t *mobj) else mobj->height = mobjinfo[MT_NIGHTSDRONE].height; + if (mthing->args[4]) + mobj->flags2 |= MF2_AMBUSH; //Kill player upon time up + droneboxmandiff = max(mobj->height - mobjinfo[MT_NIGHTSDRONE_MAN].height, 0); dronemangoaldiff = max(mobjinfo[MT_NIGHTSDRONE_MAN].height - mobjinfo[MT_NIGHTSDRONE_GOAL].height, 0); @@ -12723,8 +12726,12 @@ static boolean P_SetupSpawnedMapThing(mapthing_t *mthing, mobj_t *mobj, boolean case MT_EGGMOBILE3: mobj->cusval = mthing->args[0]; break; + case MT_BUBBLES: + if (mthing->args[0]) + mobj->flags2 |= MF2_AMBUSH; + break; case MT_FAN: - if (mthing->args[1]) + if (mthing->args[1] & TMF_INVISIBLE) { P_UnsetThingPosition(mobj); if (sector_list) @@ -12735,6 +12742,8 @@ static boolean P_SetupSpawnedMapThing(mapthing_t *mthing, mobj_t *mobj, boolean mobj->flags |= MF_NOSECTOR; // this flag basically turns it invisible P_SetThingPosition(mobj); } + if (mthing->args[1] & TMF_NODISTANCECHECK) + mobj->flags2 |= MF2_AMBUSH; if (mthing->args[0]) mobj->health = mthing->args[0]; else @@ -12754,6 +12763,8 @@ static boolean P_SetupSpawnedMapThing(mapthing_t *mthing, mobj_t *mobj, boolean case MT_BALLOON: if (mthing->stringargs[0]) mobj->color = get_number(mthing->stringargs[0]); + if (mthing->args[0]) + mobj->flags2 |= MF2_AMBUSH; break; case MT_FLAME: if (mthing->args[0]) @@ -13032,12 +13043,13 @@ static boolean P_SetupSpawnedMapThing(mapthing_t *mthing, mobj_t *mobj, boolean break; case MT_BIGTUMBLEWEED: case MT_LITTLETUMBLEWEED: - if (mthing->options & MTF_AMBUSH) + if (mthing->args[0]) { fixed_t offset = FixedMul(16*FRACUNIT, mobj->scale); mobj->momx += P_RandomChance(FRACUNIT/2) ? offset : -offset; mobj->momy += P_RandomChance(FRACUNIT/2) ? offset : -offset; mobj->momz += offset; + mobj->flags2 |= MF2_AMBUSH; } break; case MT_REDFLAG: @@ -13067,6 +13079,23 @@ static boolean P_SetupSpawnedMapThing(mapthing_t *mthing, mobj_t *mobj, boolean mobj->threshold = get_number(mthing->stringargs[0]); mobj->health = mthing->args[0] ? mthing->args[0] : TICRATE; break; + case MT_GOLDBUZZ: + case MT_REDBUZZ: + case MT_JETTBOMBER: + case MT_JETTGUNNER: + case MT_ROBOHOOD: + case MT_CRUSHSTACEAN: + case MT_BANPYURA: + case MT_BUMBLEBORE: + case MT_CACOLANTERN: + case MT_PIAN: + if (mthing->args[0]) + mobj->flags2 |= MF2_AMBUSH; + break; + case MT_EGGGUARD: + if (mthing->args[1]) + mobj->flags2 |= MF2_AMBUSH; + break; default: break; } @@ -13099,10 +13128,28 @@ static void P_SetAmbush(mobj_t *mobj) mobj->flags2 |= MF2_AMBUSH; } + //TODO: Make this obsolete else if (mobj->type != MT_AXIS && mobj->type != MT_AXISTRANSFER && mobj->type != MT_AXISTRANSFERLINE && mobj->type != MT_NIGHTSBUMPER && + mobj->type != MT_NIGHTSDRONE && + mobj->type != MT_BALLOON && + mobj->type != MT_BIGTUMBLEWEED && + mobj->type != MT_LITTLETUMBLEWEED && + mobj->type != MT_BUBBLES && + mobj->type != MT_FAN && + mobj->type != MT_ROBOHOOD && + mobj->type != MT_CRUSHSTACEAN && + mobj->type != MT_BANPYURA && + mobj->type != MT_GOLDBUZZ && + mobj->type != MT_REDBUZZ && + mobj->type != MT_JETTBOMBER && + mobj->type != MT_JETTGUNNER && + mobj->type != MT_BUMBLEBORE && + mobj->type != MT_CACOLANTERN && + mobj->type != MT_PIAN && + mobj->type != MT_EGGGUARD && mobj->type != MT_STARPOST) mobj->flags2 |= MF2_AMBUSH; } diff --git a/src/p_setup.c b/src/p_setup.c index 492c0aabc..8333c21f3 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -4929,6 +4929,27 @@ static void P_ConvertBinaryMap(void) case 111: //Pop-up Turret mapthings[i].args[0] = mapthings[i].angle; break; + case 103: //Buzz (Gold) + case 104: //Buzz (Red) + case 105: //Jetty-syn Bomber + case 106: //Jetty-syn Gunner + case 117: //Robo-Hood + case 126: //Crushstacean + case 128: //Bumblebore + case 132: //Cacolantern + case 138: //Banpyura + case 1602: //Pian + mapthings[i].args[0] = !!(mapthings[i].options & MTF_AMBUSH); + break; + case 119: //Egg Guard + if ((mapthings[i].options & (MTF_EXTRA|MTF_OBJECTSPECIAL)) == MTF_OBJECTSPECIAL) + mapthings[i].args[0] = TMGD_LEFT; + else if ((mapthings[i].options & (MTF_EXTRA|MTF_OBJECTSPECIAL)) == MTF_EXTRA) + mapthings[i].args[0] = TMGD_RIGHT; + else + mapthings[i].args[0] = TMGD_BACK; + mapthings[i].args[1] = !!(mapthings[i].options & MTF_AMBUSH); + break; case 127: //Hive Elemental mapthings[i].args[0] = mapthings[i].extrainfo; break; @@ -4954,7 +4975,10 @@ static void P_ConvertBinaryMap(void) mapthings[i].args[0] = mapthings[i].angle; mapthings[i].args[1] = mapthings[i].options & 7; break; - case 294: + case 294: //Fang waypoint + mapthings[i].args[0] = !!(mapthings[i].options & MTF_AMBUSH); + break; + case 500: //Air bubble patch mapthings[i].args[0] = !!(mapthings[i].options & MTF_AMBUSH); break; case 502: //Star post @@ -4992,11 +5016,15 @@ static void P_ConvertBinaryMap(void) break; case 540: //Fan mapthings[i].args[0] = mapthings[i].angle; - mapthings[i].args[1] = !!(mapthings[i].options & MTF_OBJECTSPECIAL); + if (mapthings[i].options & MTF_OBJECTSPECIAL) + mapthings[i].args[1] |= TMF_INVISIBLE; + if (mapthings[i].options & MTF_AMBUSH) + mapthings[i].args[1] |= TMF_NODISTANCECHECK; break; case 543: //Balloon if (mapthings[i].angle > 0) P_WriteConstant(((mapthings[i].angle - 1) % (numskincolors - 1)) + 1, &mapthings[i].stringargs[0]); + mapthings[i].args[0] = !!(mapthings[i].options & MTF_AMBUSH); break; case 555: //Diagonal yellow spring case 556: //Diagonal red spring @@ -5192,6 +5220,10 @@ static void P_ConvertBinaryMap(void) if (mapthings[i].options & MTF_EXTRA) mapthings[i].args[0] |= TMFH_CORONA; break; + case 1200: //Tumbleweed (Big) + case 1201: //Tumbleweed (Small) + mapthings[i].args[0] = !!(mapthings[i].options & MTF_AMBUSH); + break; case 1202: //Rock spawner { mtag_t tag = (mtag_t)mapthings[i].angle; @@ -5240,6 +5272,7 @@ static void P_ConvertBinaryMap(void) mapthings[i].args[3] = TMDA_MIDDLE; else mapthings[i].args[3] = TMDA_BOTTOMOFFSET; + mapthings[i].args[4] = !!(mapthings[i].options & MTF_AMBUSH); break; case 1704: //NiGHTS bumper mapthings[i].pitch = 30 * (((mapthings[i].options & 15) + 9) % 12); diff --git a/src/p_spec.h b/src/p_spec.h index 743c37744..697a140ea 100644 --- a/src/p_spec.h +++ b/src/p_spec.h @@ -69,6 +69,19 @@ typedef enum TMDS_ROTATEEXTRA = 1<<1, } textmapdiagonalspringflags_t; +typedef enum +{ + TMF_INVISIBLE = 1, + TMF_NODISTANCECHECK = 1<<1, +} textmapfanflags_t; + +typedef enum +{ + TMGD_BACK = 0, + TMGD_RIGHT = 1, + TMGD_LEFT = 2, +} textmapguarddirection_t; + //FOF flags typedef enum {